PARTITIONS
__________________________________________________________________________
This article is about the partitioning scheme that MS-DOS uses to keep
track of it's partitions. This is the standard that all PC operation
systems must use to be allowed to share hard disk resources with other
operating systems.
Send me any questions, comments, or corrections. Chris Lattner
_________________________________________________________________
DOS keeps track of partitions with a "Master Partition Table" that it
keeps at offset 1BEh in the disk's boot sector. It contains four 16
byte entries, one for each partition. Each entry is divided into ten
fields that contain all of the information necessary to describe a
partition on the hard drive, including:
* Whether this partition is the one that got booted from.
* The Head, Sector, and Cylinder where the partition starts.
* The Head, Sector, and Cylinder where the partition ends.
* The operating system that owns it.
* The number of sectors that are before this partition.
* The length of the partition in sectors.
See: Figure 1
Now the astute reader may say: "Wait a minute! On my machine I run
DOS/Windows and OS/2. I have 5 DOS partitions. How can this be!"
Microsoft's solution to this problem was to invent the "Extended DOS"
partition. If you go into FDISK, you will see that you have a
"Primary" DOS partition, and an "Extended" DOS partition (Plus
whatever else you have). You can also type in "UNFORMAT /PARTN /L" to
get a list of all of your partitions. This clearly shows the chain
format used.
More to come!
__________________________________________________________________________
Figure 1
Start End BI HSC SI HSC SBNS 0h1h2h3h4h5h6h7h 8h9hAhBhChDhEhFh This is
repeated four times (one for each partition). Offsets are: 1BEh, 1CEh,
1DEh, and 1EEh. At offset 1FEh, AA55h signifies that the disk is
bootable. The BIOS reads it in and executes it. See my article on Boot
Sectors.
Key:
BI: Boot indication. 0 = Not booted from. 80h = Booted from.
H: Head. Starting/Ending head number for the partition.
S: Sector. Starting/Ending sector number for the partition. This
field also holds bits 8 and 9 of the cylinder in standard DOS
format.
C: Cylinder. Lower 8 bits of the Starting/Ending cylinder number
for the partition.
SI: System Indicator:
00h = Unused
01h = DOS 12 bit FAT (0 - 16 megs)
02h = XENIX root file system
03h = XENIX /usr file system (obsolete)
04h = DOS 16 bit FAT (16 - 32 megs)
05h = Extended DOS partition
06h = DOS 16 bit FAT (32 megs and up)
07h = OS/2 High Performance File System
07h = Windows NT (NTFS)
07h = Advanced Unix
0Ah = OS/2 Boot Manager
+ For more, consult Ralf Brown's Interrupt list: INT 19
SB (DWORD): Number of sectors before this partition.
NS (DWORD): Number of sectors in this partition.
____________________________________________________________________
Created by Chris Lattner (sabre@teleport.com)