100 lines
4.0 KiB
HTML
100 lines
4.0 KiB
HTML
<title>Operating Systems: Partition Tables</title>
|
|
<body BGCOLOR=#FFFFFF TEXT=#000000>
|
|
<center><font face=Verdana size=7><b>Partition Tables</b></font></center>
|
|
<HR><p>
|
|
|
|
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.
|
|
<p>
|
|
|
|
Send me any questions, comments, or corrections.
|
|
<i><a href="mailto:sabre@nondot.org">Chris Lattner</a></i><p>
|
|
<HR Align=Center Width=400><br>
|
|
|
|
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: <p>
|
|
|
|
<ul>
|
|
<li>Whether this partition is the one that got booted from.<br>
|
|
<li>The Head, Sector, and Cylinder where the partition starts.<br>
|
|
<li>The Head, Sector, and Cylinder where the partition ends.<br>
|
|
<li>The operating system that owns it.<br>
|
|
<li>The number of sectors that are before this partition.<br>
|
|
<li>The length of the partition in sectors.<br>
|
|
</ul>
|
|
|
|
See: <strong><a href="#Fig_1">Figure 1</a></strong><p>
|
|
|
|
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!"<p>
|
|
|
|
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. <p>
|
|
|
|
|
|
|
|
<H2><HR Align=Center Width=400>
|
|
<A NAME="Fig_1">Figure 1</H2>
|
|
|
|
<CENTER>
|
|
<TABLE BORDER CellPadding=10 WIDTH="50%">
|
|
<TR ALIGN=CENTER>
|
|
<TD></TD><TD ColSpan=3> Start </TD><TD></TD><TD ColSpan=3> End </TD>
|
|
</TR>
|
|
<TR ALIGN=CENTER>
|
|
<TD>BI</TD>
|
|
<TD>H</TD><TD>S</TD><TD>C</TD>
|
|
<TD>SI</TD>
|
|
<TD>H</TD><TD>S</TD><TD>C</TD>
|
|
<TD ColSpan=4>SB</TD><TD ColSpan=4>NS</TD>
|
|
</TR>
|
|
<TR ALIGN=CENTER>
|
|
<TD>0h</TD><TD>1h</TD><TD>2h</TD><TD>3h</TD><TD>4h</TD><TD>5h</TD><TD>6h</TD><TD>7h</TD>
|
|
<TD>8h</TD><TD>9h</TD><TD>Ah</TD><TD>Bh</TD><TD>Ch</TD><TD>Dh</TD><TD>Eh</TD><TD>Fh</TD>
|
|
</TR>
|
|
</TABLE>
|
|
</CENTER><p>
|
|
|
|
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 <strong>
|
|
<a href="http://www.nondot.org/sabre/os/files/Booting/BootSector.html">Boot Sectors</a></strong>.<br>
|
|
|
|
<h3>Key:</H3>
|
|
<ul>
|
|
BI: Boot indication. 0 = Not booted from. 80h = Booted from. <br>
|
|
H: Head. Starting/Ending head number for the partition. <br>
|
|
S: Sector. Starting/Ending sector number for the partition. This field
|
|
also holds bits 8 and 9 of the cylinder in standard DOS format. <br>
|
|
C: Cylinder. Lower 8 bits of the Starting/Ending cylinder number for
|
|
the partition. <br>
|
|
SI: System Indicator:
|
|
<ul>
|
|
00h = Unused <br>
|
|
01h = DOS 12 bit FAT (0 - 16 megs) <br>
|
|
02h = XENIX root file system <br>
|
|
03h = XENIX /usr file system (obsolete) <br>
|
|
04h = DOS 16 bit FAT (16 - 32 megs) <br>
|
|
05h = Extended DOS partition <br>
|
|
06h = DOS 16 bit FAT (32 megs and up) <br>
|
|
07h = OS/2 High Performance File System <br>
|
|
07h = Windows NT (NTFS) <br>
|
|
07h = Advanced Unix <br>
|
|
0Ah = OS/2 Boot Manager <br>
|
|
<li>For more, consult Ralf Brown's Interrupt list: INT 19 <br>
|
|
</ul>
|
|
SB (DWORD): Number of sectors before this partition. <br>
|
|
NS (DWORD): Number of sectors in this partition. <br>
|
|
</ul>
|
|
|
|
<p><hr><FONT SIZE=4><TABLE ALIGN=RIGHT BORDER=0><TR><TD><center>
|
|
Copyright © 1994-8 <i><a href="mailto:sabre@nondot.org">Chris Lattner</a></i><br>
|
|
Last modified: Monday, 21-May-2001 13:25:25 CDT </center></TD></TR></TABLE>
|