CSCI 331 Homework 2

time due submission file
12:45 PM Tuesday 14 February, 2005 ♥ csci/331/HW2/home02.txt

Reading

If you haven't looked at the FAT32 specification, you need to now.

The assignment

The assignment is to read the FAT32 file specification and use a hex editor to determine the locations of the first ten data blocks which hold the file COMMAND.COM within the FAT12 file system. The FAT12 file system is contained in a 1474560 byte image called home02.image with is contained in a 600k byte ZIP file distributed with this assignment.

Tools

Low-level tools, like hex editors, are needed for this assignment. The two useful Unix programs for this would be od and dd. Take a quick look at the man pages for these programs now.

Already done? That was quick. Let me give you a three examples of how to use these programs. Let's say you wanted to look at the two byte integer number stored in bytes 19 and 20 of the file first.sector. You can do this with od by executing the following command:
  od -Ad -j 19 -N 2 -t d2 first.sector

And if you want to look at the eight bytes starting at offset 54 as an ASCII string, type the following:
  od -Ad -j 54 -N 8 -t a first.sector
Since you've already read the man page, I won't bother explaining those "-Ad -j 19 -N 2 -t d2" and "-Ad -j 54 -N 8 -t a" options.

You really don't need to use dd, but it does provide an easy way to break out the interesting sectors of the large home02.image file. For example, the following command would copy the 10 sectors starting at sector number 331 (where the first section is numbered 0) into a file called sectors.331-340.
  dd if=home02.image of=sectors.331-340 bs=512 count=100 skip=331
The reason for dd's weird syntax is that it was written before the present command line option style for Unix became common.

What you turn in

You need to turn in enough information to convince me that you really used od or some other hex editor, rather than just overheard someone say the answer. I suggest you use the script command to save your command sessions. You could also just cut-and-paste the relevant commands after you type them.