PC HDD, The first 512 bytes - kevshouse/The-Under_C_World GitHub Wiki


MBR Layout Table

| Offset (Bytes) | Size (Bytes) | Description | |----------------|--------------|-----------------------------------------------| | 0x000 | 446 | Bootloader code (first stage bootloader) | | 0x1BE | 16 | Partition 1 (16 bytes) | | 0x1CE | 16 | Partition 2 (16 bytes) | | 0x1DE | 16 | Partition 3 (16 bytes) | | 0x1EE | 16 | Partition 4 (16 bytes) | | 0x1FE | 2 | Boot signature (0x55AA) | | 0x200 | 64 | Extended boot signature (optional, not used in standard MBR) |
Partition Entry Layout (Each 16 bytes)

| Offset (Bytes) | Size (Bytes) | Description | |----------------|--------------|-----------------------------------------------| | 0x00 | 1 | Boot indicator (0x80 = bootable, 0x00 = non-bootable) | | 0x01 | 3 | Starting CHS address (Cylinder-Head-Sector) | | 0x04 | 1 | Partition type (e.g., 0x07 = NTFS, 0x0B = FAT32) | | 0x05 | 3 | Ending CHS address | | 0x08 | 4 | Starting LBA (Logical Block Addressing) | | 0x0C | 4 | Number of sectors in the partition |

Notes:

The MBR is 512 bytes in total, with the first 446 bytes reserved for the bootloader code.
The partition table consists of four entries, each 16 bytes long.
The boot signature at the end of the MBR is a required value (0x55AA) that indicates the presence of a valid MBR.
The CHS addressing scheme is largely considered obsolete, and modern systems primarily use LBA.

This layout is essential for understanding how disk drives are partitioned and how the operating system interacts with these partitions.