Partition Tables (Revised)



By: Walter Metcalf
Date: 06/28/00

In the preceding series we made several references to the "partition table". Therefore I thought this would be an appropriate time to supply some additional detail on this critical system component. Basically a partition table is a special location on the hard drive containing the partition information. As always with computers, however, it's not that simple. In fact it can get very complex, but in this article I'll try to stick with the basic information.

First of all there are two distinct kinds of partition tables, and there can be many of the them on the same hard drive.

  1. Master Partition Table

    1. When most people use the term "partition table," this is the one they mean. Before we go further, we need look at the overall layout of the hard drive. (The following information is true regardless of operating system used on the drive. On some otherwise excellent sites, the authors are familiar only with DOS and DOS-based operating systems, and they write in such a way as to be confusing to those of us familiar with multiple operating systems and non-DOS-based operating systems such as OS/2 and Linux. Care is needed when interpreting the information on such sites.)

      1. Master Boot Record (MBR)
        1. Also called the master boot sector, or simply boot sector, the MBR is the very first physical record (cylinder 0, head 0, sector 1) on any hard drive as it comes from the factory.

        2. The MBR contains two vital components:

          1. Bytes 0 - 445 contain the Master Boot Code
            • This is a very small program that transfers control to whatever boot program is in the active (i.e. startable) partition. In many systems this would be the OS/2 Boot Manager.

              Note: there can be several bootable partitions on a hard drive, but only one startable partition. Some writers don't distinguish adequately between these two partition characteristics.

            • The Master Boot Code can be re-created by the special command FDISK /NEWMBR.1This command should NEVER be used except at the express direction of a competent technician thoroughly familiar with your problem--and then only if your data is backed up.
            • Because it is so critical to all systems, the Master Boot Code is a favourite target of viruses.
            • Specialized programs such as On-Track Disk Manager, used to overcome limitations that prevent old BIOS's from accessing large drives properly, modify the Master Boot Code with some special code variously called partition table driver, dynamic driver overlay, etc. which translates the hard drive sector addresses into addresses that the computer's BIOS can handle. (You can think of these programs as "friendly viruses.") However, I agree with Charles Kozierok, author of The PC Guide when he says that such programs should be used only as a last resort and or an interim basis. They can cause compatibility problems and can be difficult to remove when you upgrade your BIOS or motherboard.

          2. Bytes 446 - 509 contain the Master Partition Table
            • The Master Partition Table is 64 bytes in length and contain 4 entries, one for each primary partition. Since each partition entry requires 16 bytes, a hard drive can have a maximum of 4 primary partitions.
            • Each partition entry contains:
              • Byte indicating whether or not the partition is active (i.e. startable).
              • The starting cylinder, head, and sector of the partition
              • The ending cylinder, head, and sector of the partition
              • The number of sectors in the partition
              • Byte indicating how the partition is formatted

        3. Finally, there is a two-byte signature identifying this sector as a boot sector.

  2. Extended Partition Table

    1. This structure exists only if the physical drive contains an extended partition, that is, a primary partition that is subdivided into logical partitions, or drives.

      The information about the extended partition is stored in the master partition table. In an extended partition table entry, the starting address links to an extended partition table. The format of the extended partition table is identical to that of the master partition table except that it contains at most two entries. If the extended partition contains only one logical drive, then there is a single entry pointing to the logical boot sector for that drive. If there is more than one logical drive, the extended partition table contains a second entry which points to yet another extended partition table whose first entry points to the second logical drive, and so on until all logical drives are linked. (One writer, Andrew Pitonyak, has stated an extended partition table can contain two logical drives and two extended partitions. I have not been able to confirm this. At best, this would be an unusual situation.)

      There can be a maximum of 23 extended partition tables on a physical hard drive.

  3. Volume Boot Sector

    While the volume boot sector is technically not part of the partition table structures, I'm adding it for completeness. Every volume (i.e. logical drive) has one, located, apparently, at the end of the drive's track 0, which is otherwise hidden from the system. It is to this record that the partition table entry links--not to the actual code or data.

    The volume boot sector contains two items:

    1. Disk Parameter Block

      This information contains detailed information about the logical drive, such as its type, length, and name.

    2. Volume Boot Code

      This contains the boot program specific to the drive if active; otherwise it is ignored.

Walter Metcalf

For Further Reading:

Hard Disk Logical Structures and File Systems, The PC Guide, © 1997-98 Charles M. Kozierok
Inside the High Performance File System, EDM/2, December 1996, by Dan Bridges
The Partition Table, EDM/2, March 1998, by Andrew Pitonyak

Removing or Disarming PC Viruses
Common sense talk about antivirus hype as well as discussion about where partition table fits into virus problem.

Next week: System Commander 2000: A Review

Notes

1 This the OS/2 FDISK command format. Note that it is case sensitive and different from the DOS FDISK command format.


Unless otherwise noted, all content on this site is Copyright © 2004, VOICE