MASTER BOOT RECORD PARTITIONS

The first method of having multiple partitions was to create something called a Master Boot Record (MBR) on the first sector of the hard disk. This was developed way back in the 1980s. A maximum of four partitions are permitted in the Master Boot Record. At most one of these four partitions can be marked as bootable. The overall format for a MBR is shown in Table 5.1.

Table 5.1. Master Boot Record Format

Offset Length Item
0 (0x00) 446 (0x1BE) Boot code
446 (0x1BE) 16 (0x10) First partition
462 (0x1CE) 16 (0x10) Second partition
478 (0x1DE) 16 (0x10) Third partition
494 (0x1EE) 16 (0x10) Fourth partition
510 (0x1FE) 2 (0x2) Signature 0x55 0xAA

Each of the partition entries in the MBR contains the information shown in Table 5.2.

Table 5.2. Partition Entry Format

Offset Length Item
0 (0x00 1 (0x01) Active flag (0x80 = bootable)
1 (0x01) 1 (0x01) Start head
2 (0x02) 1 (0x01) Start sector (bits 0-5); upper bits of cylinder (6-7)
3 (0x03) 1 (0x01) Start cylinder lowest 8 bits
4 (0x04) 1 (0x01) Partition type code (0x83 = Linux)
5 (0x05) 1 (0x01) End head
6 (0x06) 1 (0x01) End sector (bits 0-5); upper bits of cylinder (6-7)
7 (0x07) 1 (0x01) End cylinder lowest 8 bits
8 (0x08) 4 (0x04) Sectors preceding partition (little endian)
12 (0x0C) 4 (0x04) Sectors in partition

Let’s discuss these fields in the partition entries one at a time. The first entry is an active flag where 0x80 means active and anything else (usually 0x00) is interpreted as inactive. In the Master Boot Record active means it is bootable. For obvious reasons there can be at most one bootable partition. That doesn’t mean that you cannot boot multiple operating systems, just that you must boot to some sort of selection menu program to do so.

The next entry is the starting head for the partition. This is followed by the starting sector and cylinder. Because the number of cylinders might exceed 255 and it is unlikely that so many sectors would be in a single track, the upper two bits from the byte storing the sector are the upper two bits for the cylinder. This system allows up to 64 sectors per track and 1024 cylinders. Note that with only three bytes of storage partitions must begin within the first eight gigabytes of the disk assuming standard 512 byte sectors.

The entry following the starting address is a partition type code. For Windows systems this type code is used to determine the filesystem type. Linux systems normally use 0x83 as the partition type and any supported filesystem may be installed on the partition. Partition type 0x82 is used for Linux swap partitions.

The cylinder/head/sector address of the end of the partition follows the partition type. The same format is used as that for the starting address of the partition. The number of sectors preceding the partition and total sectors occupy the last two positions in the partition entry. Note that these are both 32-bit values which allows devices up to two terabytes (2048 gigabytes) to be supported. Most modern devices use Logical Block Addressing (LBA) and the cylinder/head/sector addresses are essentially ignored.

results matching ""

    No results matching ""