To overcome the limitation of having only four partitions on the disk, one of the entries in the master boot record partition table can be set instead to be anextended partition entry by means of the partition type values 05h or 0fh (see Appendix 5). Thisfirst extended partition, which takes up a primary partition slot, is essentially no more than acontainerfor one or more enclosedlogicalorsecondarypartitions.The first sector of the first extended partition holds another partition table, with the rest of that sector usually set to zeros.This extended partition table (see Fig. 5.28) starts at the same offset address within the sector as the master boot record partition table, that is, at 1beh and although it is four 16 byte partition entries in length, terminated as before by 55h aah, it is only permitted to hold a maximum oftwopartition entries.
The first of these entries is likely to specify alogicalpartition, sometimes referred to as asecondarypartition, and this partition may contain a file system and, excep- tionally, an operating system. If an operating system is to be used, it must be one that is capable of being booted from a logical partition (as opposed to a primary partition). Operating systems which are believed to incorporate this feature include Windows NT, OS/2 and Linux78. The second entry in the extended partition table may specify another extended partition which itself starts with an extended partition table.
Terminology is likely to get in the way again here. These inner secondary extended partitions are rather different from the outer primary extended partition container,
Fig. 5.28 Extended partition table.
77 However, some operating systems can be booted from an extended partition so it is possible to have more than four.
78 The Windows XP help file states: “The active partition must be a primary partition on a basic disk”.
although the same partition type code is used throughout and they are all referred to simply as extended partitions. The outer or first extended partition is a container for all the logical partitions; the inner secondary extended partitions each contain just a single logical partition. This is shown diagrammatically at Fig. 5.29.
Here we see a master boot record79(marked mbr) at CHS 0,0,1 with two entries in the partition table. The first entry is a primary partition starting at CHS 0,1,1 and ending at CHS 255,63,63. This, in the example shown, is the active partition and contains the operating system. It would normally be assigned the drive letter “C:” by MS-DOS. The second entry is the first extended partition starting at CHS 256,0,1 and ending at CHS 522,63,63. This partition is never assigned a drive letter and, as can be seen from the diagram, it simply acts as a container for the three logical partitions. In the first sector (CHS 256,0,1) of the first extended partition we find the extended partition table80(marked ept1) and this contains two entries. The first is a logical partition starting at CHS 256,1,1 and ending at CHS 380,63,63. If there were no other drives with a primary partition in the system, this logical partition would be assigned the logical drive letter “D:” by MS-DOS (see following section for details of drive letter allocations). The second entry in the extended partition table at CHS 256,0,1 is a secondary extended partition. This starts at CHS 381,0,1 and ends at CHS 505,63,63. We can see from the diagram, that, unlike the first extended partition that contains all the logical partitions, this secondary extended partition only contains one logical partition. At the beginning of the partition (CHS 381,0,1), we find
0,0,1 0,1,1 255,63,63 mbr | primary |
256,0,1 522,63,63 | first extended partition (container) |
256,1,1 380,63,63 ept1 | logical | 381,0,1 505,63,63 | extended | 381,1,1 505,63,63 ept2 | logical | 506,0,1 522,63,63 | extended | 506,1,1 522,63,63 ept3 | logical |
Fig. 5.29 Extended and logical partitions.
79 This is the same master boot record as is shown in Figs. 5.26 and 5.27. 80 This is the same extended partition table as is shown at Fig. 5.28.
another extended partition table, marked ept2 in the diagram, again with two entries. The first entry is a logical partition starting at CHS 381,1,1 and ending at CHS 505,63,63. If there were no other drives with a primary partition in the system, this logical partition would be assigned the logical drive letter “E:” by MS-DOS. The second entry in the extended partition table, ept2, at CHS 381,0,1 is another secondary extended partition. This starts at CHS 506,0,1 and ends at CHS 522,63,63. At the beginning of this partition (CHS 506,0,1), we find another extended partition table, marked ept3, this time with only one entry. This entry is a logical partition starting at CHS 506,1,1 and ending at CHS 522,63,63. If there were no other drives with a primary partition in the system, this logical partition would be assigned the logical drive letter “F:” by MS-DOS.
It should be noted that our explanation of how extended partitions are constructed does not entirely conform with some of the published literature on the subject. It is, however, an accurate representation of what we have found in a series of experiments that we carried out in order to determine precisely the binary format of the extended partition structures when using the standard Micrososft FDISK functions. We have given more details of these experiments at Appendix 6, and Fig. 5.29 represents, in effect, a summary of our findings.