PC Boot Process

Although booting problems most often occur with dual Operating Systems (OSs), say Linux and Windows, understanding the way a PC boots from hardware into a disk-based OS is essential to resolving them.  That normally happens as follows:

  1. The BIOS determines the boot disk, with most modern PCs this can be chosen via settings (the BIOS can usually be entered from system power up by pressing and holding down a particular key, often designated on the screen at the appropriate time to press it, usually <Delete> or one of the <F?> 'function' keys)
  2. It loads and runs the first physical sector (C=0,H=0,S=1 or LS=0) from that disk, the Master Boot Record (MBR).  Traditionally, the MBR contained a boot loader in the first half-sector and a partition table in the second (the standard sector size is 512 or 0x200 bytes, so each half sector is obviously 256 or 0x100 bytes).  Nowadays, it's common to find boot loader code crosses the former limit to almost the beginning of the partition table at byte 448 or 0x1C0, though Vista has a new non-standard partition table and may not boot properly if the boot loader goes over 440 or 0x1B8, see Vista's New Partitioning Rules.
  3. This boot loader then looks at the partition table, finds the first partition marked active (Microsoft tools only allow, and usually there will only be, one), and loads and runs the first sector of that partition, which is the Partition Boot Record (PBR).
  4. This PBR then loads and runs that partition's Operating System (OS) in an OS-dependent way.

In theory then, alternative boot loaders such as LILO or GRUB (commonly used to dual-boot Linux and Windows) have only to list some or all of the active partitions on the disks and ask which MBR or, more commonly, PBR to boot.

There is a generic boot floppy that offers to boot from any MBR or PBR it finds at boot-time on your system.  Although now getting outdated, it can still be quite useful in debugging boot problems.  It's part of the Slackware Linux distribution:

There is also a useful legacy Windows help article on booting Windows from a floppy:

That's the theory, but in practice there are some pitfalls ...

One particularly important one is that Microsoft MBRs don't quite follow the above rules.  They ignore whichever disk they were actually loaded and run from, assume it was HardDisk 0, and always read the partition table from, and boot the first active partition on, HardDisk 0!

If you make up the linked SBootMgr floppy, and find that when you boot from an MBR on a disk other than HardDisk 0, the OS on HardDisk 0 is the one that actually loads, then that other disk almost certainly has a Microsoft MBR.

Another pitfall is that alternative boot loaders are restricted by the available space in the level of intelligence they can reach, so nearly all load secondary code/data from elsewhere.

For example, Lilo uses a so-called 'map' file, and when you run the Lilo command to install it, you aren't only installing Lilo's MBR but also this map file.

Hence, the relative placement of a bootloader's MBR and any associated secondary code/data is important.  Particularly, if after installing a boot loader drive designations are changed or the secondary code/data is moved, the MBR may then be unable to find everything it needs, and consequently hang the boot process.

Another source of confusion is that different OSs, bootloaders, and disk utility programs number hard disks differently.  For some, the first hard disk is numbered 0, for others 1, for others a, while yet others use the DOS designation of 128 or 0x80!