I am new to Linux. In my attempts to understand the ext3 and FAT filesystems, I want to write a C code to access the raw sectors to read the MBR and layout of the filesystems.
I formatted the USB with two partitions ext3 and FAT and study them.
I would need read / write access on the raw sectors of the usb drive.
I googled for the information and found
- Directly access the dev file in linux for the usb (say /dev/sdb) and do an open/read/write/lseek combination to read the raw sectors.
- Another way, would be to write a wrapper over an IOCTL and construct the scsi packets and do queries .. but read/write and dd internally do this anyway.
Am I on the right track .... ?
I want to know are there any other efficient methods or which of the above is the proper approach to access the raw sectors of the USB device?
All responses appreciated, Thanks in advance.