MBR/EBR Partition Tables
(Page 3)

Copyright © 2004, 2007 by Daniel B. Sedory
NOT to be reproduced in any form without Permission of the Author!


These pages are going through a major REVISION; some sections may presently be incomplete; if the topic doesn't make sense, contact us.


 

Real Partition Table Examples


In summary, the layout of a Master Boot Record's sector is as follows:

 Offset     Size                Description
 ------  ---------   ----------------------------------
  000h   446 bytes    Master bootstrap loader code area
                     (includes the NT Drive S/N if any;
    see the Standard, FAT32 and NTFS MBRs for example.)

  1BEh    16 bytes    Partition entry for partition 1
  1CEh    16 bytes    Partition entry for partition 2
  1DEh    16 bytes    Partition entry for partition 3
  1EEh    16 bytes    Partition entry for partition 4

  1FEh     2 bytes    Signature ID, the WORD: AA55h;
                       indicates a valid MBR sector.



A 20 GB Hard Drive with Three OSs



Figure 5.


This is a Hex view of just the last 80 bytes of a hard disk's MBR sector as they might appear in a disk editor. The Partition Table is enclosed within the thin YELLOW line in the diagram above. Two other items also appear in this diagram: 1) The thin violet/purple line surrounding the Hex bytes "A8 E1 A8 E1" shows an example of an NT Disk Signature (also used by Win 2000/XP) and:  2) The sector's Word-sized Signature ID of AA55h; often called its Magic number in older tech documentation.
[ Note: on Intel x86 CPU systems, Hex Words are stored with the Low-byte first and the High-byte last so AA55h appears as:  55 AA  in a disk editor ].

In the upper-right corner of the table, you'll see a byte with the value of  80 . This is the first byte in the first Partition entry, and it's followed by the bytes  01 01 00 . Most HDDs have these bytes, since the first partition is usually the boot partition on most hard disks the 80h byte tells the Bootstrap Loader code (the MBR code) which partition it is supposed to try loading a Boot sector from into Memory; only one partition entry (at boot-up) can have the 80h byte here] and because the next three bytes are the CHS values for the Starting Sector of the first partition (CHS 0,1,1 in this case; which corresponds to Absolute Sector 63 of this disk, where most Boot Records begin).

Until HDDs became larger than 8.4 GB, the Starting and Ending CHS values and the Total Sector value could be checked against each other; which might help to correct an error for a manual entry in the Table. Example: The Last Sector CHS values (877,254,63) can be used to check the Total number of Sectors by first computing:  878 cylinders x 255 heads x 63 sectors = 14,105,070 sectors (don't forget that both the Cylinder and Head counts begin with a zero), and then subtracting the 63 sectors which preceded it to arrive at: 14,105,007 sectors for its Total size or length. Thus, you can see that they must agree with each other!

Before launching into all the calculations for the rest of this drive's partition table, we need to point out that this isn't the typical layout for a drive created by a Microsoft OS. Instead of a single Primary partition followed by an Extended partition, this drive has three Primary partitions and then an Extended partition!

The First 16-byte Entry in our Partition Table
Byte(s)
Offset
Value in this
Example
Description
Meaning
1BE
80
Bootable? (80h = Yes; 00 = No)
YES
1BF - 1C1
01 01 00
 Starting Sector ( in CHS )
[ First byte always = Head value ]
0, 1, 1
1C2
 07
Partition Type
NTFS
1C3 - 1C5
 FE FF 6D
 Last Sector ( in CHS ):
[ FEh = 254 for Head ]
FF 6D = (1111 1111) (0110 1101)
are regrouped as: [11 1111]  [11 0110 1101]
3Fh = Sector 63 and  36Dh = 877 (Cylinder)
877, 254, 63
1C6 - 1C9
 3F 00 00 00
 Relative Sectors (or Offset )
( 0000003Fh = 63 )
63
1CA - 1CD
 AF 39 D7 00
Total Sectors (or Length )
( 00D739AFh = 14,105,007 )
14,105,007

In the table above, you'll find that computing CHS values isn't always very easy to do! Though the whole first byte for each Starting and Ending CHS entry is always for the Head*, the Cylinder and Sector bytes must be regrouped before you can compute them! To compute the Sector value, you must remove the leading two bits of the second (or middle) byte; thus the largest value you can have for a Sector is: 3Fh (__11 1111) = 63. To compute the Cylinder value, the two bits from the middle byte become the first two bits of a ten-bit hex number that ends with the last byte in each CHS entry. So, the largest value you can have for a Cylinder is: 3FFh (11 1111 1111) = 1023 (in the table, which gives you a count of 1024 cylinders). Since these are the largest values that can be used in any Standard Partition Table, all CHS values are limited to: 1024 x 255* x 63 = 16,450,560 sectors (or 8,422,686,720 bytes); thus the 8.4 GB limit for any BIOS without the newer INT 13 Extensions (such as Functions 42, 43 and 48 for reading, writing and getting drive parameters)!
________________
*For those who missed the note about why we do not use 256 heads, see this: Note about a 'bug' in MS-DOS.

 


 

Therefore, when any part of a partition reaches further than 8.4 GB into a drive, you lose some redundancy as can be seen in the Last Sector CHS portion of this entry:

The Second 16-byte Entry in our Partition Table
Byte(s)
Offset
Value in this
Example
Description
Meaning
1CE
00
Bootable? (80h = Yes; 00 = No)
NO
1CF - 1D1
00 C1 6E
 Starting Sector ( in CHS )
[ First byte: 00h = 0 for Head value ]
C1 6E = (1100 0001) (0110 1110) in Binary
are regrouped as: [00 0001]  [11 0110 1110]
01h = 1 sector and  36Eh = 878 (Cylinder)
878, 0, 1
1D2
 0C
Partition Type
FAT32
LBA
1D3 - 1D5
 FE FF FF
 Last Sector ( in CHS ): FE = 254 (Head)
FF FF = (1111 1111) (1111 1111)
are regrouped as: [11 1111]  [11 1111 1111]
3Fh = Sector 63 and  3FFh = 1023 (Cylinder)
Beyond
8.4 GB
1D6 - 1D9
 EE 39 D7 00
 Relative Sectors (or Offset)
( 00D739EEh = 14,105,070 )
14,105,070
1DA - 1DD
 BD 86 BB 00
Total Sectors (or Length)
( 00BB86BDh = 12,289,725 )
12,289,725

If the Cylinder value wasn't limited to 1023, then the Last Sector CHS triple's cylinder value could be computed as follows: 26,394,795 (14,105,070 + 12,289,725; the same as the Relative Sector Offset in the next entry!) divided by 16,065 (255 x 63) = 1643 cylinders. So, the CHS would be: 1642,254,63.

And for any full partition that's beyond 8.4 GB, such as the last two entries in our example Partition Table above, only the values inside of the thin GREEN lines can be used to compute both a partition's actual size and location!  Note both the Starting Sector and Last Sector items in our example Table's third entry:

The Third 16-byte Entry in our Partition Table
Byte(s)
Offset
Value in this
Example
Description
Meaning
1DE
00
Bootable? (80h = Yes; 00 = No)
NO
1DF - 1E1
 FE FF FF
 Starting Sector ( in CHS ): FE = 254 (Head)
FF FF = (1111 1111) (1111 1111)
are regrouped as: [11 1111]  [11 1111 1111]
3Fh = Sector 63 and  3FFh = 1023 (Cylinder)
Beyond
8.4 GB
1E2
 83
Partition Type
Linux Ext2
1E3 - 1E5
 FE FF FF
 Last Sector ( in CHS )
[ Same as for FE FF FF above! ]
Beyond
8.4 GB
1E6 - 1E9
 AB C0 92 01
 Relative Sectors (or Offset)
( 0192C0ABh = 26,394,795 )
26,394,795
1EA - 1ED
 CD 2F 03 00
Total Sectors (or Length)
( 00032FCDh = 208,845 )
208,845

 

Finally, the fourth entry in our example Table is that of an LBA Extended Partition (type = 0Fh). In the case of any Extended Partition, its Total Sectors (or Length) includes all of the Logical partitions that may exist inside of it, whether there's only one or many. Extended Partitions often run all the way to the end of a drive's useable sectors, but they don't have to. You should also note that even if all four entries of a Partition Table are being used, that does not necessarily mean there's no empty space left on a drive.

The Fourth 16-byte Entry in our Partition Table
Byte(s)
Offset
Value in this
Example
Description
Meaning
1EE
00
Bootable? (80h = Yes; 00 = No)
NO
1EF - 1F1
 FE FF FF
 Starting Sector ( in CHS ): FE = 254 (Head)
FF FF = (1111 1111) (1111 1111)
are regrouped as: [11 1111]  [11 1111 1111]
3Fh = Sector 63 and  3FFh = 1023 (cylinder)
Beyond
8.4 GB
1F2
 0F
Partition Type
Extended
( LBA )
1F3 - 1F5
 FE FF FF
 Last Sector ( in CHS )
[ Same as for FE FF FF above! ]
Beyond
8.4 GB
1F6 - 1F9
 78 F0 95 01
 Relative Sectors (or Offset)
( 0195F078h = 26,603,640 )
26,603,640
1FA - 1FD
 83 AF CC 00
Total Sectors (or Length)
( 00CCAF83h = 13,414,275)
13,414,275

 


Footnotes

 


<-- Previous Page

Last Update: June 9, 2007. (2007.06.09)

You can write to us here: contact page (opens in a new window).

MBR and Boot Records Index

The Starman's Realm Index Page

 

 

 

 

Hosted by uCoz