Go to the ATA-ATAPI.COM Home Page
Here is the most complete description of how partition tables work.
FDISK creates all partition records (sectors). The primary purpose of a partition record is to hold a partition table. The rules for how FDISK works are unwritten but so far most FDISK programs (DOS, OS/2, WinNT, etc) seem to follow the same basic idea.
First, all partition table records (sectors) have the same format. This includes the partition table record at cylinder 0, head 0, sector 1 -- what is known as the Master Boot Record (MBR). The last 66 bytes of a partition table record contain a partition table and a 2 byte signature. The first 446 bytes of these sectors usually contain a program but only the program in the MBR is ever executed (so extended partition table records could contain something other than a program in the first 466 bytes). See Master Boot Record.
Second, extended partitions are "nested" inside one another and extended partition table records form a "linked list". I will attempt to show this in a diagram below.
Each partition table entry is 16 bytes and contains things like the start and end location of a partition in CHS, the start in LBA, the size in sectors, the partition "type" and the "active" flag. Warning: older versions of FDISK may compute incorrect LBA or size values. And note: When your computer boots itself, only the CHS fields of the partition table entries are used (another reason LBA doesnt solve the >528MB problem). The CHS fields in the partition tables are in L-CHS formatsee "How It WorksCHS Translation".
There is no central clearing house to assign the codes used in the one byte "type" field, however, there is at least one person at both Microsoft and IBM that attempt to keep track of the type codes. Type codes are used to define most every type of file system that anyone has ever implemented on the x86 PC: 12-bit FAT, 16-bit FAT, HPFS, NTFS, etc. Plus, an extended partition also has a unique type code. Refer to Partition Type Codes for the complete list of known partition type codes is contained in part 2 of this document.
The 16 bytes of a partition table entry are used as follows:
+--- Bit 7 is the active partition flag, bits 6-0 are | zero (when not zero this byte is also the drive | number of the drive to boot so the active | partition is always found on drive 80H, | the first hard disk). | | +--- Starting CHS in INT 13 call format. | | | | +--- Partition type byte. | | | | | | +--- Ending CHS in INT 13 call format. | | | | | | | | +-- Starting LBA. | | | | | | | | | | +-- Size in sectors. | | | | | | v ---+---- v ---+---- v v 0. 1. 2. 3. 4. 5. 6. 7. 8.9.A.B. C.D.E.F. DL DH CL CH TB DH CL CH LBA..... SIZE.... 80 01 01 00 06 0e be 94 3e000000 0c610900 1st entry 00 00 81 95 05 0e fe 7d 4a610900 724e0300 2nd entry 00 00 00 00 00 00 00 00 00000000 00000000 3rd entry 00 00 00 00 00 00 00 00 00000000 00000000 4th entry
Bytes 0-3 are used by the small program in the Master Boot Record to read the first sector of an active partition into memory. The DH, DL, CH and CL above show which x86 register is loaded when the MBR program calls INT 13H AH=02H to read the active partitions boot sector. See Master Boot Record.
These entries define the following partitions:
Keep in mind that there are NO written rules and NO industry standards on how FDISK should work but here are some basic rules that seem to be followed by most versions of FDISK:
There are NO written rules as to how an OS scans the partition table entries so each OS can have a different method. For DOS, this means that different versions could assign different drive letters to the same FAT file system partitions.
What do I mean when I say the partitions are "nested" within each other? Lets look at this example:
M = Master Boot Record (and any unused sectorson the same track)
E = Extended partition record (and any unused sectors on the same track) pri = a primary partition (first sector is a "boot" sector) sec = a secondary partition (first sector is a "boot" sector)
|-----------------the entire disk---------------| | | |M[pri] | | E[sec]----rest of 1st ext part-----------| | E[sec]----rest of 2nd ext part-----|
The first extended partition is described in the MBR and it occupies the entire disk following the primary partition. The second extended partition is described in the first extended partition record and it occupies the entire disk following the first secondary partition.
What do I mean when I say the partition records (tables) form a "linked" list? This means that the MBR has an entry that describes (points to) the first extended partition, the first extended partition table has an entry that describes (points to) the second extended partition table, and so on. There is, in theory, no limited to out long this linked list is. When you ask FDISK to show the DOS "logical drives" it scans the linked list looking for all of the DOS FAT type partitions that may exist. Remember that in an extended partition table, only two entries of the four can be used (rule 2 above).
And one more thing... Within a partition, the layout of the file system data varies greatly. However, the first sector of a partition is expected to be a "boot" sector. A DOS FAT file system has: a boot sector, first FAT sectors, second FAT sectors, root directory sectors and finally the file data area. See OS2 Boot Sector.
A disk containing four DOS FAT partitions (C, D, E and F):
|----------------------the entire disk--------------------| | | |M[---C:---] | | E[---D:---]--rest of 1st ext part-------------| | E[---E:---]--rest of 2nd ext part--| | E[---------F:----------]|
So here is an example of a disk with two primary partitions, one DOS FAT and one OS/2 HPFS, plus an extended partition with another DOS FAT:
|-------------------the entire disk-------------------| | | |M[pri 1 - DOS FAT] | | [pri 2 - OS/2 HPFS] | | E[sec - DOS FAT]|
Or in more detail (n is the highest cylinder, head or sector number number allowed in the indicated field of the CHS)...
+-------------------------------------+ CHS=0,0,1 | Master Boot Record containing | | partition table search program and | | a partition table | | +---------------------------------+ | | | DOS FAT partition description | | points to CHS=0,1,1 | +---------------------------------+ | points to CHS=a | | OS/2 HPFS partition description | | | +---------------------------------+ | | | unused table entry | | | +---------------------------------+ | | | extended partition entry | | points to CHS=b | +---------------------------------+ | +-------------------------------------+ CHS=0,0,2 | the rest of "track 0" -- this is | : to | where the software drivers such as | : normally CHS=0,0,n | Ontrack's Disk Manager or Micro | : unused | House's EZ Drive are located. | : +-------------------------------------+ CHS=0,1,1 | Boot sector for the DOS FAT | : | partition | : a DOS FAT +-------------------------------------+ : file CHS=0,1,2 | rest of the DOS FAT partition | : system to | (FAT table, root directory and | : CHS=x-1,n,n | user data area) | : +-------------------------------------+ CHS=x,0,1 | Boot sector for the OS/2 HPFS | : | file system partition | : an OS/2 +-------------------------------------+ : HPFS file CHS=x,0,2 | rest of the OS/2 HPFS file system | : system to | partition | : CHS=y-1,n,n | | : +-------------------------------------+ CHS=y,0,1 | Partition record for the extended | | partition containing a partition | | record program (never executed) and | | a partition table | | +---------------------------------+ | | | DOS FAT partition description | | points to CHS=b+1 | +---------------------------------+ | | | unused table entry | | | +---------------------------------+ | | | unused table entry | | | +---------------------------------+ | | | unused table entry | | | +---------------------------------+ | +-------------------------------------+ CHS=y,0,2 | the rest of the first track of the | : normally to | extended partition | : unused CHS=y,0,n | | : +-------------------------------------+ CHS=y,1,1 | Boot sector for the DOS FAT | : | partition | : a DOS FAT +-------------------------------------+ : file CHS=y,1,2 | rest of the DOS FAT partition | : system to | (FAT table, root directory and | : CHS=n,n,n | user data area) | : +-------------------------------------+
Here is a partition record from an extended partition (the first sector of an extended partition). Note that it contains no program code. It contains only the partition table and the signature data.
OFFSET 0 1 2 3 4 5 6 7 8 9 A B C D E F *0123456789ABCDEF* 000000 00000000 00000000 00000000 00000000 *................* 000010 TO 0001af SAME AS ABOVE 0001b0 00000000 00000000 00000000 00000001 *................* 0001c0 8195060e fe7d3e00 0000344e 03000000 *.....}....4N....* 0001d0 00000000 00000000 00000000 00000000 *................* 0001e0 00000000 00000000 00000000 00000000 *................* 0001f0 00000000 00000000 00000000 000055aa *..............U.*
Thanks to Kenneth C. Yue for pointing out that in V0 of this document I did not properly describe the unused sectors normally found around the partition table sectors.
Thanks to Marcus Better for pointing out that in V1a-c of this document I did not properly describe the x86 registers that the partition table entry data is loaded into when INT 13 is called.
The following table of partition type codes was compiled from many sources including information from kind people at IBM and Microsoft plus Ralf Browns list.
Both IBM and Microsoft keep the partition type code lists and both have until recently assigned type codes. However, there apparently is no formal agreement between these two companies and their lists are not always in sync or up to date. It should be noted that the lists I obtained from IBM and Microsoft are fairly short and show most of type type codes as "available" or "reserved". My guess is that many type codes have been used without the knowledge of the IBM or Microsoft. This is probably the case since neither IBM or Microsoft have published a phone number or email address to contact if you wanted to request a type code. Chaos is the keyword here.
It now appears that neither company is assigning new type codes. I have also been told that it is now recommended that anyone defining a new partition type, or more correctly stated, anyone defining a new file system type, should use partition type 07 and use the first block(s) of the partition to fully define the file system type. Of course, the appearance of a new type code could cause problems for older versions of FDISK, various older operating system device drivers and disk utility programs. (This new use of type code 07 doesnt explain the recent "assignment" of type codes 0E and 0F.)
[If you know of a type code assignment that is not listed here please let me know about it ASAP. Thanks, Hale]
Note that several type codes have multiple uses (for example, see code 08). Also note that there is some question about the use of some codes as denoted by a ? in the description.
Code Description 00 Unused partition table entry 01 DOS, 12-bit FAT 02 XENIX root 03 XENIX user 04 DOS, 16-bit FAT 05 Extended partition (includes other partition types) 06 DOS, 32+MB support, up to 64K Allocation unit 07 See partition boot record(s) for file system type: could be QNX, OS/2 HPFS, Windows NT NTFS, Unix, ... 08 OS/2 (thru Version 1.3 only) 08 DELL partition spanning multiple drives (array) 08 Commodore DOS 08 AIX boot? or file system? 09 AIX boot? or file system? 09 Coherent swap 0A OS/2 Boot Manager 0A OPUS 0A Coherent swap 0B FAT32 0C FAT32 LBA (SEE NOTE BELOW) 0D ? (perhaps a type 07 LBA, SEE NOTE BELOW) 0E FAT16 LBA (SEE NOTE BELOW) 0F Extended partition LBA (SEE NOTE BELOW) NOTE: Partitions types 0C, 0E and 0F (perhaps 0D too) REQUIRE that the systems INT 13 BIOS support the IBM/Microsoft/Phoenix extended/enhanced functions calls (AH=4x). In these partition table entries the CHS fields are NOT used and are generally set to maximum values (all 1 bits) in each CHS field. What this means is that some day there will be an LBA type partition for all the other partition types that are listed here and still in use by some system. This will certainly use up many of the currently unused type codes! 10 OPUS 11 OS/2 Boot Manager: Inactive type 01 12 Compaq diagnostics 13 Available for assignment 14 OS/2 Boot Manager: Inactive type 04 14 Novell DOS 7.0 FDISK (result of bug in FDISK?) 15 Available for assignment 16 OS/2 Boot Manager: Inactive type 06 17 OS/2 Boot Manager: Inactive type 07 18 AST Windows swap file 18 Compaq System Diagnostics 19 - 1F Available for assignment 20 Available for assignment 21 Reserved 22 Available for assignment 23 Reserved 24 NEC version of MS-DOS 25 Available for assignment 26 Reserved 27 - 2F Available for assignment 30 Available for assignment 31 Reserved 32 Available for assignment 33 Reserved 34 Reserved 35 Available for assignment 36 Reserved 37 - 3B Available for assignment 3C PowerQuest PartitionMagic recovery partition 3D - 3F Available for assignment 40 VENIX :Venix 80286 41 Personal RISC Boot 41 PowerPC boot 42 Secure File System (Peter Gutmann) 43 - 4E Available for assignment 4F Oberon boot and data 50 OnTrack Disk Manager (read-only) 51 OnTrack Disk Manager (write-only) 51 Novell 51 OnTrack Disk Manager (read-only) 52 CP/M 52 Microport 53 OnTrack Disk Manager (write-only) 54 OnTrack Disk Manager (DDO) 55 Available for assignment 56 GoldenBow VFeature 57 - 5F Available for assignment 60 Available for assignment 61 SpeedStor 62 Available for assignment 63 UNIX System V/386 63 Mach, MtXinu BSD 4.3 on Mach 63 GNU HURD 64 Speedstore 64 Novell 65 Novell 286 Netware 66 Novell 386 Netware 67 Novell 68 Novell 69 Novell 6A - 6F Available for assignment 70 DiskSecure Multi-Boot 71 Reserved 72 Available for assignment 73 - 74 Reserved 75 PC/IX 76 Reserved 77 - 79 Available for assignment 7A - 7F ? (probably "available for assignment", these codes are not shown in the IBM or Microsoft lists!) 80 Minix (ver. 1.4a and earlier) 81 Minix (ver. 1.4b and later) 81 Mitac Advanced Disk Manager 81 Linux 82 Prime 82 Linux swap 82 Solaris UNIX 83 Linux ext2fs 84 OS/2 hiding a type 04 85 Available for assignment 86 Reserved 87 HPFS FT mirrored partition 88 - 8F Available for assignment 90 - 92 Available for assignment 93 Ameba file system 94 Ameba bad block table 95 - 98 Available for assignment 99 Mylex EISA SCSI 9A - 9F Available for assignment A0 Available for assignment A1 Reserved A2 Available for assignment A3 - A4 Reserved A5 FreeBSD A6 Reserved A7 - A8 Available for assignment A9 NetBSD AA - AF Available for assignment B0 Available for assignment B1 Reserved B2 Available for assignment B3 - B4 Reserved B5 Available for assignment B6 Reserved B7 BSDI file system or secondarily swap B8 BSDI swap or secondarily file system B9 - BD Available for assignment BE Solaris boot partition BF Available for assignment C0 Available for assignment C1 DR-DOS LOGIN.EXE-secured 12-bit FAT C2 BlueSky Innovations boot manager C3 BlueSky Innovations boot manager C4 DR-DOS LOGIN.EXE-secured 16-bit FAT C5 Available for assignment C6 DR-DOS LOGIN.EXE-secured Huge C7 HPFS FT disabled mirrored partition C7 Cyrnix Boot C8 - CF Available for assignment D0 - D7 Available for assignment D8 CP/M 86 D9 - DA Available for assignment DB Concurrent DOS, CP/M and CTOS DC - DF Available for assignment E0 Available for assignment E1 Speedstore E2 Available for assignment E3 Storage Dimensions E4 Speedstore E5 - E6 Reserved E7 - EA Available for assignment EB BeOS BFS EC - EF Available for assignment F0 Available for assignment F1 Storage Dimensions F2 DOS 3.3+ second partition F3 Reserved F4 Speedstore F4 Storage Dimensions F5 Available for assignment F6 Reserved F7 - FD Available for assignment FE IBM PS/2 IML, LANstep FF Xenix(?) Bad Block Tables
This page was last updated on 05 October 1999.