Copyright © 2009 Li Hong
Permission is granted to reprint or republic this article as long as the original source information and the copyright are kept.
Extended Partition
As we mentioned in Hard Disk, a hard disk can have at most four primary partitions. If we want more partitions, we can change one primary partition into an extended one by subdividing it into logic ones and setting the partition type to 0x5 (extended type).
Like Master Boot Record (MBR) describing a hard disk, a Extended Boot Record (EBR) is used for a logic partition. However, there is one EBR for each logic partition and all the logic partitions in a extended partition is linked one by one using two partition table records in MBR.
EBRs have essentially the same structure as the MBR; except only the first two entries of the partition table are supposed to be used.
The structure of EBR is as follows:
Offset | Description | Size |
---|---|---|
0x0000 | Generally unused | 446 |
0x01BE | Partition Table's First entry | 16 |
0x1CE | Partition Table's Second entry | 16 |
0x1DE | Unused | 32 |
0x1FE | MBR signature (0x55, 0xAA) | 2 |
Follows is the layout of one 16-byte partition record:
Offset | Length | Description |
0x00 | 1 | status (0x80 = bootable, 0x00 = non-bootable, other = invalid) |
0x01 | 3 | CHS address of first sector in partition |
0x04 | 1 | partition type |
0x05 | 3 | CHS address of last sector in partition |
0x08 | 4 | Starting Sector |
0x0C | 4 | Number of sectors in partition, in little-endian format |
The first entry of an EBR partition table points to the logical partition belonging to that EBR:
- Starting Sector = relative offset between this EBR sector and the first sector of the logical partition This will be the same value for each EBR on the same hard disk; usually 63.
- Number of Sectors = total count of sectors for this logical partition
The second entry of an EBR partition table will contain zero-bytes if it's the last EBR in the extended partition; otherwise, it points to the next EBR in the EBR chain:
- Starting Sector = relative address of next EBR within extended partition in other words: Starting Sector = LBA address of next EBR minus LBA address of extended partition's first EBR
- Number of Sectors = total count of sectors for next logical partition, but count starts from the next EBR sector
The following figure gives an example of a hard disk holding an extended partition and a primary partition. There are two logic partitions in the extended partition.
No comments:
Post a Comment