II.  Generalities


II.4  Logical structure of a hard disk drive, boot process

Primary and extended partitions, file systems

Each hard disk has to be partitioned before any data can be stored on it. A partition is a contiguous chunk of the hard disk space and contains either, a file system, or logical volumes, as it is primary or extended. A file system is an arrangement of directories and files strictly connected with an operating systems which implements it. Internally, a logical volume resembles a primary partition. It also contains a file system, and from such point of view, primary partitions and logical volumes are indistinguishable, thus we call them all simply volumes. Logical volumes may be considered primary partitions, lined up in a chain within an extended partition, so that the first one holds the address of the second one and so on. Sometimes, logical volumes are called logical drives or logical partitions.


Note: We make strict distinction between partitions and slices. Partitions are an element of the x86 architecture, while slices are related to data storage on Unix systems.


Only four partitions per a hard disk drive are allowed. Extended partitions and logical volumes were developed to allow the use of larger hard disks with DOS, while the compatibility with previous standards is preserved. Logical volumes help also to keep data on a hard disk well organized, and to avoid the slack which appears when large clusters are used on large partitions. See [Kozierok] for further details on this topic.

Within DOS and Windows 3.x/95/98 only the first primary and the first extended partition of the hard disk are accessible. Solaris, Linux, and Windows NT can access all volumes in any combination, i.e. their fdisk programs may create and delete multiple primary and extended partitions. In DOS and Windows for all volumes, that are accessible, consecutive letters - drive letters - are assigned, starting with C. To determine the way letters are assigned following rules apply:

  1. IDE/ATA disks takes precedence before SCSI ones,
  2. a hard disk marked as a boot disk takes precedence before others,
  3. physical connection of IDE/ATA disks determine the order of letters: master, slave for older, one channel, IDE controller and primary master, primary slave, secondary master, secondary slave for newer, two channel, EIDE controller,
  4. SCSI host adapter's BIOS settings and the order of devices in the SCSI chain determine the order of SCSI disks,
  5. primary partitions takes precedence before logical volumes,
  6. order of logical volumes on one extended partition stays unchanged.

This schema of assignment has nothing to do with lettering in the BIOS boot sequence. When two channel EIDE controller is used then primary master drive has assigned letter C, primary slave D, secondary master E and secondary slave F.

In Windows NT drive letters to all volumes, except the boot partition, may be assigned manually. In W2K additionally volumes (file systems) may be mounted in directories.

The main difference between primary and extended partition is that only the first one is boot-able by BIOS. There are boot managers e.g. Lilo or Ranish PM that are able to boot from logical volume. Obviously, operating system files may be stored on primary as well on extended partition. Usually, only a few files which are used in the early phase of the boot process must reside on the boot primary partition.

There are many file systems, but the most commonly used are: FAT-16, FAT-32 implemented in Service Release 2 of Windows 95, NTFS implemented by Windows NT 4.0, UFS used by Solaris, and HPFS used by OS/2. FAT-16 is recognized and fully supported by most operating systems available on PC platform. FAT-16 volume is a good solution for data exchange between operating systems running on the same machine. FAT-16 and FAT-32 are not compatible. NT 4.0 does not recognize FAT-32 without additional software while W2K fully supports it.


Note: NTFS version 3 used by NT 4.0 is not compatible with NTFS version 5 introduced in Service Pack 4 for NT 4.0 and used by W2K. All NTFS volumes version 3 are automatically converted to version 5 when used under W2K. The operation can not be reversed, which makes them unusable in NT 4.0.


Solaris UFS file system has been improved in Solaris 7 by acquisition of journal file system methods, which can save headaches with data restoration after the system crash or unattended power failure. The new feature is called "logging" and can be turned on when a file system is mounted. On the command line it is done by supplying -o logging file system specific option to mount command (see mount, mount_ufs man pages). To mount default file systems during boot process logging should be added to mount option field in /etc/vfstab configuration file (see vfstab man page).

Master Boot Record (MBR)

The first sector of a hard disk drive is called its Master Boot Record or briefly MBR. Its coordinates are Cylinder 0, Head 0, Sector 1. It stores two sorts of information: Master Partition Table and Master Boot Code. Master Partition Table, also known as fdisk table, contains the descriptions of the partitions on the hard disk. Since MBR must fit into 512 bytes there is only room for four partitions. Therefore, a hard disk can have up to four partitions.


Table II.4.1: Master Boot Record specification.
Offset Size Description
+ 0x000 0x1BE Master Boot Code
+ 0x1BE 0x010 Partition #1
+ 0x1CE 0x010 Partition #2
+ 0x1DE 0x010 Partition #3
+ 0x1EE 0x010 Partition #4
+ 0x1FE 0x002 End of Master Boot Table marker - 0x55 0xAA

Note: Windows NT and W2K store the information on drive letter assignment in NT Disk Signature, which is unique for every hard disk drive. This signature is simply 4 bytes of MBR starting at byte 0x1B8 - right before the definition of partition number 1. Most of boot managers and partition managers do not preserve this bit of data, which may lead to troubles in case of non-standard drive lettering.


Each partition entry in the Master Partition Table has its Partition ID, Activity Flag, Start Cylinder/Head/Sector, and End Cylinder/Head/Sector specified.


Table II.4.2: MBR partition entry specification.
Offset Size Description
+ 0x00 0x01 Activity Flag
+ 0x01 0x01 Start Head
+ 0x02 0x02 0x0A bits for Start Cylinder, 0x06 bits for Start Sector
+ 0x04 0x01 Partition ID
+ 0x05 0x01 End Head
+ 0x06 0x02 0x0A bits for End Cylinder, 0x06 bits for End Sector
+ 0x08 0x04 The number of the first sector of the partition, relative to the entire disk
+ 0x0C 0x04 The size of the partition measured in sectors

The Partition ID specifies the type of the partition (or to what OS it belongs), Activity Flag determines which primary partition should be booted, and the Start/End specify location of the partition [Richmond]. The following Partition IDs are mostly used:


Table II.4.3: Example partition identifiers.
Partition ID Description
0x01 DOS12 (12-bit FAT)
0x04 DOS16 (16-bit FAT)
0x05 Extended
0x06 BIGDOS FAT-16
0x07 Windows NT (NTFS), OS/2 (HPFS)
0x0B FAT-32
0x0C FAT-32 LBA
0x0E FAT 16 LBA
0x0F Extended LBA
0x63 Unix SysV/386
0x81 Linux/Minix
0x82 Solaris x86 UFS, Linux swap
0x83 Linux ext2fs
0x85 Linux Extended
0xA5 FreeBSD, NetBSD, BSD/386
0xBE x86 Boot
0xEB BeOS

If there is an extended partition on the disk, Master Partition Table holds a link to an Extended Partition Table that describes the first logical volume for the partition. That table contains information about that first logical volume, and a link to the next Extended Partition Table which describes the second logical volume on that partition, and so on. This allows for infinite number of logical volumes, theoretically.

To load an operating system, BIOS as a starting point of the boot process, needs to know where that operating system resides. Instead, BIOS loads Master Boot Code - small initial boot program in the MBR. This program eventually transfers control to the partition boot program stored at the first sector of the active partition.

Volume Boot Sector (VBS)

Each volume - primary partition or logical volume - has its own Volume Boot Sector. This is distinct from the MBR that controls the entire disk, but is similar in concept. Each VBS contains Disk Parameter Block and Volume Boot Code. Disk Parameter Block, sometimes called the media parameter block, is a data table that contains specific information about the volume, such as its size, number of sectors it contains, label name etc. Volume Boot Code is a code that is specific to an operating system that is using this volume and is used to start the load of the operating system.

The Volume Boot Sector is created during a high-level format of a hard disk partition. On floppy disks, the first physical sector is VBS.

Solaris Volume Boot Sector is called Partition Boot Record, or shortly PBR.

The boot process

The boot process, also known as bootstrapping, on PC begins when the computer is turned on (cold start), or after the reset (warm start). First, the system firmware in the BIOS ROM executes a power-on self test (POST), a kind of hardware check, and runs BIOS extensions in peripheral board ROMs. After devices are configured, BIOS invokes software interrupt Int 19h. The Int 19h handler typically loads the first physical sector of the boot disk into memory locations 0x0000:0x7C00 through 0x0000:0x7DFF and then passes control to the boot code placed in that sector. Which disk is the boot one depends on the BIOS boot sequence setting. When SCSI is selected, then suitable setting in the SCSI host adapter's BIOS ROM determines the boot drive. Newer BIOSes allow to boot from CD-ROM, LAN or some removable media like ZIP or LS-120.

On a hard disk, the first physical sector is its MBR, and the boot code is the Master Boot Code. First, MBR moves itself to 0x0000:0x0600, then loads the VBS of the first active primary partition on the boot disk to it's original location 0x0000:0x7C00, and jumps to its first byte, unless a non-standard Master Boot Code is in use, such as Lilo or Ranish PM. This completes the standard PC hard disk sequence.

For a floppy disk, the first physical sector is the VBS. The BIOS does not care whether it is loading an MBR or a VBS. When booting from a floppy disk, which has no partitioning information and therefore no MBR, only the VBS is effectively loaded (cf. [Locke]).

After the BIOS passed control to either, MBR in case of booting from a hard disk, or VBS when booting from a floppy, the boot program specific to the operating system is started. Its behavior depends strictly on the operating system. Generally, the rest of the boot process, as well as its initial part, is divided into more and more advanced boot stages. Some operating systems like Solaris, Linux, or NT allow for user interaction during the system load. All these systems offer their own boot managers, i.e. programs which give user some control over the boot process, and thus make coexistence of many operating systems on one machine easier. A boot manager need not to be the part of an operating system. There are many third party boot managers, from tiny OS-BS, to very powerful, though complex, System Commander.

DOS and Windows 3.x/9x boot process is simplified. There is no user interaction. Volume Boot Code simply loads io.sys file, which then loads device drivers and starts user shell.

Modern operating systems are not limited to boot off the local hard disk drive only. Solaris and NT are capable to boot across the network. This makes possible to have fully functional workstations with no hard disk drives, which reduces costs of management and administration.