Understanding MultiBooting
and Booting Windows from an Extended Partition

by Dan Goodell

Exploring the Partition Tables

PowerQuest's Partition Table Editor (ptedit.exe) is an excellent tool for exploring the master partition table, extended partition tables, and the boot record parameter tables in each boot sector.

Caution: Ptedit is a DOS program with a user-friendly graphical interface, but is not made to be used without a mouse. To use ptedit, boot to DOS, load a DOS mouse driver, and then launch ptedit.)


The graphics below show our hard disk, which is configured as having 4864 cylinders, 255 heads, and 63 sectors per track. The range of sector values for this disk is 1-63, and the range of head values is 0-254. Cylinder values start at 0, but Int13h limitations prevent using a cylinder value above 1023. In order to use this 40 GB hard disk, the computer's BIOS includes support for Int13h extensions.

Primary Partitions

Ptedit opens with the master boot sector (CHS 0/0/1 or LBA 0) and displays the master partition table and its four entries. Familiarize yourself with this table to make sure you understand it.

In this example, primary partition 1 starts at CHS 0/1/1 and ends at CHS 15/254/63. The ending sector is at the end of 16 full cylinders (numbered 0-16), with partition 2 starting at CHS 16/0/1, or LBA sector 257040 (16*255*63 = 257040). Since partition 1 starts at LBA 63 (CHS 0/1/1), the total size of the partition is (257040 - 63 = 256977) sectors.

The "Sectors Before" value is the relative offset of the partition from this table. This table is on LBA 0 and the partition starts on LBA 63, so the relative offset is (63 - 0 = 63).

Partition 2 starts at CHS 16/0/1. Again, since this table is at the front of the disk, 257040 is both the LBA starting sector number and the relative offset ("Sectors Before") from the table. Partition 3 starts at CHS 405/0/1, so partition 2's size is (405*255*63 - 257040 = 6249285) sectors.

Click the [Set Type] button to reveal the byte codes for the various partition types (expressed as two-character hexadecimal values), but be careful not to accidentally alter any of the values in the partition table. Notice there are codes for hidden partitions, as well. How clever--to hide or unhide a partition we need only change the partition-type entry! The rest of the fields in that line of the partition table remain intact to show the space occupied by that partition is not unallocated free space.

Remember that one of the four primary partitions may be defined as type "Extended", which can contain one or more logical volumes. The table indicates the extended primary partition (type "0F") begins 19535040 sectors from this table. That should be CHS 1216/0/1, but note the table entry indicates the partition begins at CHS 1023/0/1. This is an example of the CHS value being "pegged" at the 1024-cylinder limit and LBA taking over. The "Sectors" and "Sectors Before" fields are correctly calculated, but the Starting/Ending Cylinder fields in the partition table cannot hold a value larger than 1023. The size of the extended partition is 58605120 sectors, or about 30 GB.

The Extended Partition

Click [Goto EPBR] to jump to the extended partition table.

We are now looking at the first sector of the extended partition, which PowerQuest calls the Extended Partition Boot Record. The beginning of the extended partition contains a secondary partition table. The display reminds us this is sector 19535040.

The first entry in this extended partition table (EPT) is our first logical volume--in this case a hidden NTFS partition (type "17"). We're now on Cyl 1216, well above the 1023 mark, so the Cyl values in the table are still meaningless and pegged at 1023. The table shows the hidden NTFS partition begins 1 head down from here and the "Sectors Before" field concurs (1 head is 63 sectors away), so we can calculate the partition begins at LBA (19535040 + 63 = 19535103). The table doesn't tell us the ending cylinder, but the size is 13028652 sectors, or about 6 GB. Since we know the extended primary partition is about 30 GB, there is 24 GB more to account for.

The second entry in this EPT shows the balance of the extended partition starts 13028715 sectors away. Note that equals 63 (the start of the NTFS partition) plus 13028652 (the size of that partition). This extended partition remainder starts at LBA sector (19535040 + 13028715 = 32563755). If we click [Goto EBPR] we will find yet a third partition table there. The entire primary extended partition is a chain of EPTs, each one defining one more logical volume and chaining to the next.

While we're on the first EPT, click on [Boot Record] to display the parameter table of the NTFS partition's boot sector.
(Warning: if you are using an old version of ptedit.exe, see here).

The Partition Boot Sector

Remember, the partition's boot sector is the first sector of the logical volume, not the EPBR. The volume itself begins at LBA 19535103. Ptedit recognizes it's a NTFS partition, so displays the boot sector's parameter table appropriately.

Find the entry for "Hidden Sectors". Oops, it shows 63! This needs to be the number of sectors from the beginning of the disk to this partition boot sector. Change it to 19535103, click [Write], then click [Close]. With this correction the boot record will now be able to find the rest of its own partition when it starts up.

(Warning: Do not confuse this with the "63" in the "Sectors Before" field of the partition table. What we are correcting is the "Hidden Sectors" field in the partition's boot record.)

After clicking [Close], we are back again at the EPT at sector 19535040. Click [Goto EBPR] to follow the chain to the next EPT at sector 32563755.

The extended partition table at sector 32563755 defines our second logical partition, a Win98 FAT32 partition at sector (32563755 + 63 = 32563818). Follow the steps to look at the parameter table in the partition boot sector and correct the Hidden Sectors field.

Continue following the chain of EPTs to correct each partition's Hidden Sectors field. We need to correct the Hidden Sectors fields only for boot records. Our two data volumes in the extended partition will not have boot records to be corrected.

Primary partitions normally have this field initialized correctly, so it's really only logical partitions we have to worry about. Now our OS's in the extended partition should be able to boot correctly.

Note: some tools, such as recent versions of PartitionMagic and Ghost, are sophisticated enough to properly initialize the "Hidden Sectors" value in the partition boot record parameter table. Check the parameter table to be sure, but you may or may not have to manually make any changes.

author: Dan Goodell, ©2003-2005

Back