Filesystems Activity, Part 1 ---------------------------- 1. Create a FAT FS image $ dd if=/dev/zero of=test.img bs=1M count=32 $ mkfs.vfat -F16 test.img 2. Mount your FAT FS image on your Linux machine $ sudo mkdir /mnt/disk $ sudo mount test.img /mnt/disk 3. Create a file in your disk image $ echo "test" > /mnt/disk/test.txt 4. Unmount you disk image $ umount /mnt/disk 5. Write a function in C that reads one sector (512 bytes) from your disk image. Function prototype should be something like: int read_sector(int fd, unsigned int sector_num, char *buf) { // ... } Your read_sector() function needs to read from an offset from the beginning of the filesystem image. That offset is 512*sector_num bytes. You can use the lseek() syscall to seek to the position in the file that you want to read from. Call your read_sector() function and read the contents of one of the sectors. Print the contents in hex to the terminal. Use the hexdump utility to confirm that you have read the correct data: $ hexdump -C test.img | less