Partition Tables and File Structure
Task 1: MBS Boot Sector
Reading commands
In MS-DOS, start debug and use the INT 13 disk service to read the MBS boot-sector information:
1 | -A 100 |
The MS-DOS screen cannot scroll back through the output, so I displayed the data in two parts and joined the screenshots.


Interpreting the data
The master boot record (MBR) has the following layout:
| Bootloader machine code | Partition table ×4 | Signature/validity marker |
|---|---|---|
| 446B | 64B | 2B 0X55AA |
The first 446 bytes contain the bootloader’s machine code, which is the same across the MBR disks examined here. I exported those bytes from an XP MBP disk with WINHEX and opened them in IDA to see the assembly below. Most disks today use GPT instead.

My DOS installation has only one partition, so there is only one partition-table entry to decode:
80 01 01 00 0B 7F BF 07 3F 00 00 00 C1 FB 3F 00
80: An active partition containing a bootloader.
01 01 00: Start position: track 01, sector 01, cylinder 00.
0B: Partition type FAT32.
7F BF 07: End position: track 7F, sector BF, cylinder 07.
3F 00 00 00: Number of sectors relative to the first sector, 0x3F in little-endian order.
C1 FB 3F 00: Total sectors occupied on disk, 0x3FFBC1 in little-endian order. Converted to GB:
$$
0x3FFBC1\times512\div1024\div 1024\div 1024 = 2GB
$$
The sector ends with the signature 55 AA.
Task 2: DBS and BPB
Use INT 13 again, this time to read the first sector of drive C:
1 | debug |
The resulting sector data looks like this:


The disk boot record (DBR) has the following fields:
| Jump instruction | OEM identifier | BPB | Extended BPB | Bootloader machine code | End marker |
|---|---|---|---|---|---|
| 3B | 8B | 53B | 26B | 420B | 2B 0X55AA |
E8 58 90: Jump instruction, translated into assembly as JMP SHORT 0000005A;NOP. Offset 005A from the start is the bootloader entry address.
4D 53 57 49 4E 34 2E 31: Manufacturer OEM identifier.
00 02: 512 bytes per sector.
08: 8 sectors per cluster.
20 00: 00 20, or 32 reserved sectors.
02: Number of FATs.
00 00: Zero root directory entries.
00 00: Zero small sectors.
F8: Hard disk media.
00 00: Zero sectors per FAT.
00 3F: 63 sectors per track.
00 80: 128 heads.
3F 00 00 00: 63 hidden sectors.
C1 FB 3F 00: 4,193,217 sectors total, or 4193217*512/1024/1024/1024=2GB.
F7 0F 00 00: 4,087 sectors per FAT.
00 00: Extended flags.
00 00: File system version.
02 00 00 00: Root directory cluster number 2.
01 00: File system information sector number 01.
06 00: Backup boot sector.
00 00 00 00 00 00 00 00 00 00 00 00: 12 reserved bytes.
Extended BPB:
80: Physical drive number, indicating a hard disk.
00: Reserved.
29: Extended boot signature, 0x28 or 0x29.
E7 17 31 0B: Partition serial number.
4D 53 44 4F 53 37 31 30 20 20 20: 11-byte volume label, here MSDOS710 .
46 41 54 33 32 20 20 20: System ID, here FAT32.
Task 3: Read the FAT
Create a text file first. Then use the L command in DEBUG to read the DBR data:
1 | echo "this is a test text" -> this_is_a_long_long_long_long_name.txt |
The following screenshots show what I read:



52 52 61 41: Extended boot signature.
The remaining fields shown here are unused.
25 f7 07 00: 522,021 sectors remain unused.
Next, calculate the location of the file allocation table (FAT). The MBR tells us drive C starts at sector 00 3F, so -L 2,0,1 reads one sector at 00 3f into the buffer. The DBR shows 00 20 reserved sectors. Since the FAT follows the DBR:
FAT1 start sector = DBR sector number + reserved sectors = 3f+20 = 5f,
Enter -l 1000 2,20,1 in DEBUG to display the first FAT:

Because this is FAT32, each FAT entry occupies four bytes.
The usable cluster numbers begin at 2. Entry 0 is always F8 FF FF 0F; entry 1 records abnormal system errors and is usually FF FF FF FF or FF FF FF 0F .
From entry 2 onward, each four-byte entry points to the next cluster in a file’s chain; FF FF FF 0F marks the end. In this example, there are two small files.
Task 4: Find a file
Next, calculate the position of the file directory table (FDT). The DBR data shows that each FAT occupies 0x0FF7 sectors. With two FATs and two partition tables:
0x20+0xff7*2 = 0x200e
Because files were already present, I added one sector to reach the entry I wanted.
Enter -l 1000 2,200f,1 in DEBUG to read the data, then -d 1000 1100 to display it.

The entry for the file we just created, this_is_a_long_long_long_long_name.txt, appears under the short name THIS_I~1TXT.

Together, these images give us enough information to inspect the file’s directory entry.
FAT32 stores the pieces of a long filename in reverse order, so we may need to look backward through several sectors to find them all.
54 48 49 53 5F 49 7E 31: Short filename THIS_I~1.
54 58 54: Extension TXT.
20: Attributes, bin(0x20)=100000, meaning archive.
00: Reserved by the system.
00: Creation time in 10-millisecond units.
FB 90: Creation time.
10010 000111 11011
That corresponds to 18:07:54.
66 4F: Creation date.
0100111 1011 00110
That is 2019-11-6.
66 4F: Last access date. The file has not been accessed since creation, so this is the creation date.
00 00: High part of the starting cluster number.
FB 90: File modification time. The file has not been modified since creation, so this is the creation date.
66 4F: File modification date. The file has not been modified since creation, so this is the creation time.
B2 08: Low part of the starting cluster number.
19 00 00 00: File size.
Next, look at the long-filename entries above the short entry. I selected one of them to decode:

01: Sequence number.
74 00 68 00 69 00 73 00 5F 00:this_
0F: Long directory attribute flag, fixed at this value.
00: Reserved.
FB: Short filename checksum.
69 00 73 00 5F 00 61 00 5F 00 6C 00:is_a_l
00 00: Always zero.
6F 00 6E 00:on
Using S = (C-2)x P + B, the location we want is (08B2-2)*8+200e=658e.
Read that sector with -l 1000 2,658e,1, then enter d 1000 1100 to display the file contents.

Task 5: Delete a file
Enter del THIS_I~1.txt in DOS to delete the file.

Now inspect the file’s entry in the FDT:

The first sequence-number byte has changed to E5, but the first cluster number still points to the original location.
Next, inspect the FAT:

The FAT appears unchanged in this example. Now inspect the data area itself:

The file’s contents are still in their original location.
Task 6: Recover a file
For the recovery test, create a text file in Windows XP:

Use the same method as above to locate its data area in WINHEX:

Delete the file:

Return to the file’s data area in WINHEX. Create a new file and paste the remaining data into it to recover the original contents:
