Table of Contents
This chapter introduces various methods for booting the installed system. First, some of the technical details of the boot process are explained to help with understanding the various methods. This is followed by a detailed description of the default boot manager GRUB.
After turning on your computer, the first thing that happens is that the BIOS (Basic Input Output System) takes control, initializes the screen and keyboard, and tests the main memory. At this point, no storage media or external devices are known to the system.
After that, the system reads the current date and time as well as information about the most important peripheral devices from the CMOS setup. After reading the CMOS, the BIOS should recognize the first hard disk, including details such as its geometry. It can then start to load the operating system (OS) from there.
To load the OS, the system loads a 512-byte data segment from the first hard disk into main memory and executes the code stored at the beginning of this segment. The instructions contained in it determine the rest of the boot process. This is why the first 512 bytes of the hard disk are often called the Master Boot Record (MBR).
Up to this point (loading the MBR), the boot sequence is independent of the installed operating system and is identical on all PCs. Also, all the PC has to access peripheral hardware are those routines (drivers) stored in the BIOS.
The layout of the MBR always follows a standard that is independent of the operating system. The first 446 bytes are reserved for program code. The next 64 bytes offer space for a partition table for up to four partitions (see Section 1.7. “Partitioning for Experts”). Without the partition table, no file systems exist on the hard disk — the disk would be virtually useless without it. The last two bytes must contain a special magic number (AA55). An MBR containing a different number would be considered invalid by the BIOS and any PC operating system.
Boot sectors are the first sectors on a hard disk partition, except in the case of extended partitions, which are just containers for other partitions. Boot sectors offer 512 bytes of space and are designed to contain code capable of launching an operating system on this partition. Boot sectors of formatted DOS, Windows, and OS/2 partitions do exactly that (in addition, they contain some basic data about the file system structure). In contrast, the boot sector of a Linux partition is empty (even after creating a file system on it). Thus, a Linux partition cannot bootstrap itself, even if it contains a kernel and a valid root file system. A boot sector with a valid start code contains the same magic number as the MBR in its last two bytes (AA55).
The DOS MBR of the first hard disk contains information that determines which partition of a hard disk is active (bootable). The active partition is searched for the operating system to boot. Therefore, DOS must be installed on the first hard disk. The DOS program code in the MBR is the first stage of the boot loader. It checks if the specified partition contains a valid boot sector.
If this is the case, the code in this boot sector can be loaded as the second stage of the boot loader, which in turn loads the system programs. Subsequently, the DOS prompt appears or the Windows user interface is started. In DOS, only one primary partition can be marked as active. This is why you cannot install the DOS system on logical drives in an extended partition.