Data Storage - The Master Boot Record (MBR)
Table of Contents
1 - About
The MBR is the most important data structure on the disk and is created when the disk is partitioned.
The MBR contains a small amount of executable code called:
At the end of the MBR is a 2-byte structure called a signature word or end of sector marker, which is always set to 0x55AA. A signature word also marks the end of an extended boot record (EBR) and the boot sector.
The use of basic or dynamic disk does not affect where the MBR is located on disk and only minor differences exist between the two for how the partition table is configured.
There is no MBR on a floppy disk. The first sector on a floppy disk is the boot sector. Although every hard disk contains an MBR, the master boot code is used only if the disk contains the active, primary partition.
2 - Articles Related
3 - Master Boot Code
The master boot code performs the following activities:
- Scans the partition table for the active partition.
- Finds the starting sector of the active partition.
- Loads a copy of the boot sector from the active partition into memory.
- Transfers control to the executable code in the boot sector.
If the master boot code cannot complete these functions, the system displays one of the following error messages:
Invalid partition table. Error loading operating system. Missing operating system.
4 - Disk signature
The disk signature, a unique number at offset 0x01B8, identifies the disk to the operating system.
Windows 2000 uses the disk signature as an index to store and retrieve information about the disk in the registry subkey HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices.
5 - Partition Table
The partition table, a 64-byte data structure used to identify the type and location of partitions on a hard disk, conforms to a standard layout independent of the operating system. Each partition table entry is 16 bytes long, with a maximum of four entries. Each entry starts at a predetermined offset from the beginning of the sector, as follows:
- Partition 10x01BE(446)
- Partition 20x01CE(462)
- Partition 30x01DE(478)
- Partition 40x01EE(494)
In Windows 2000, Only basic disk makes use of the partition table . Dynamic disk uses the Disk Management database located at the end of the disk for disk configuration information. The partition table is not updated when volumes are deleted or extended after the dynamic disk upgrade, or when new dynamic volumes are created.
5.1 - The Starting and Ending chs
The Starting and Ending chs (Cylinder, Head and Sector) fields are additional elements of the partition table. These fields are essential for starting the computer. The master boot code uses these fields to find and load the boot sector of the active partition. The Starting CHS fields for non-active partitions point to the boot sectors of the remaining primary partitions and the EBR of the first logical drive in the extended partition.
Knowing the starting sector of an extended partition is very important for low-level disk troubleshooting. If your disk fails, you need to work with the partition starting point (among other factors) to retrieve stored data.
The Ending Cylinder field in the partition table is 10 bits long, which limits the number of cylinders that can be described in the partition table to a range of 0–1,023. The Starting Head and Ending Head fields are each one byte long, which limits the field range to 0–255. The Starting Sector and Ending Sector fields are each six bits long, which limits the range of these fields to 0–63. However, the enumeration of sectors starts at 1 (not 0, as for other fields), so the maximum number of sectors per track is 63.
Maximum disk capacity
Because all hard disks are low-level formatted with a standard 512-byte sector, the maximum disk capacity described by the partition table is calculated as follows:
Maximum capacity = sector size x cylinders (10 bits) x heads (8 bits) x sectors per track (6 bits)
Using the maximum possible values yields:
512 x 1024 x 256 x 63 (or 512 x 2^24) = 8,455,716,864 bytes or 7.8 GB
The calculation results in a maximum capacity of slightly less than 8 gigabytes (GB). Before logical block addressing (LBA) were introduced, the active, primary partition could not exceed 7.8 GB, regardless of the file system used.