Master Boot Record
Master Boot Record and Device Partitioning
Each sector is 512 bytes. A boot sector is looked at by
the BIOS and determined by the last two bytes of the sector. That
is, it will have 0x55 and 0xAA in the
sector. A boot sector is always the first sector.
The BIOS copies the boot sector contents into memory and the boot sector proceeds to boot.
Apart from boot code, the first sector can contain any of the following:
- A partition table describing the partitions of the storage device. In this context it is called the partition sector.
- Bootstrap code, akin to boot code but to chain load.
- Optional 32 bit disk timestamp.
- Optional 32 bit disk signature.
The entire layout of the first sector looks something like this
GENERIC FIRST SECTOR:
| Address | Description | bytes |
|---|---|---|
| 0x0 | Bootstrap code area | 446 |
| 0x01be | Partition entry 1 | 16 |
| 0x01ce | partition entry 2 | 16 |
| 0x01de | partition entry 3 | 16 |
| 0x01ee | partition entry 4 | 16 |
| 0x01fe | boot signature (last two bytes 0x55AA) | 2 |
This is the layout of the partition entry:
| Offset | Field Length | Description |
|---|---|---|
| 0x00 | 1 byte | Status |
| 0x01 | 3 bytes | CHS address |
| 0x04 | 1 byte | partition type |
| 0x05 | 3 bytes | CHS address of the last sector |
| 0x08 | 4 bytes | LBA of the first absolute sector of the partition |
| 0x0C | 4 bytes | Number of sectors in partition |