Partition table

A partition table is a logical division of a hard disk. Partitioning of a hard disk allows the following:
 * Multiple and different operating systems on the same hard disk
 * Multiple and different file systems on the same hard disk

A hard drive's partition table is located within the MBR (master boot record), or the first sector of the hard drive, and contain 64 bytes of partition table information. There are four 16 byte partition table entries.

Master Boot Record (offset) 0x0000 to 0x01BD - First 446 bytes 0x01BE to 0x01CD - Partition entry 1 0x01CE to 0x01DD - Partition entry 2 0x01DE to 0x01ED - Partition entry 3 0x01EE to 0x01FD - Partition entry 4 0x01FE to 0x01FF - Boot signature

Your operating system will look for the 2 byte boot signature at the end of the partition table to determine the boot sector.

Each partition table consists of the following:

Boot indicator (0x00 for off, 0x80 for on)  -- 1 Byte Starting head, cylinder and sector          -- 3 Bytes Filesystem descriptor                       -- 1 Byte Ending head, cylinder and sector            -- 3 Bytes Starting sector (relative to disk beginning) -- 4 Bytes Number of sectors in partition              -- 4 Bytes

All bytes are arranged in little endian

Following is a sample partition table layout:

offset: value                 explanation ======: =====                 =========== 0x01BE: 0x80                   bootable flag (0x00 for flag off, 0x80 for on) 0x01BF: 0x00 0x02 0x00        starting head, cylinder and sector 0x01C2: 0x83                  filesystem descriptor 0x01C3: 0x1A 0x5B 0x8C        ending head, cylinder and sector 0x01C6: 0x02 0x00 0x00 0x00   starting sector (relative to beginning of disk) 0x01CA: 0x00 0x35 0x0C 0x00   number of sectors in partition