Overview#GRUB is a very different bootloader from LILO. GRUB has a two-stage or three-stage operation, and has network boot capabilities (of course, the network boot facilities don't give you a way to get GRUB itself loaded: you'll still need network boot firmware).
Stage 1 #Stage 1 consists of 512 bytes and its only task is to load the second stage of the boot loader.
The firmware loads the GRUB boot sector into memory. This is a standard (512 byte) boot sector and, thus far, the process is the same as for lilo or and other x86 Intel based systems. Encoded in the boot sector are the numerical disk block addresses of the sectors that make up the implementation of the next stage. GRUB then loads the blocks that are required for the next stage using BIOS calls.
Stage 1.5#In some configurations, an intermediate stage 1.5 can be used, which locates and loads stage 2 from an appropriate File System. If possible, this method is chosen by default on installation or when initially setting up GRUB with YaST.
Stage 2#Stage 2 GRUB puts up a menu of defined boot options, and exposes a command-line to the operator. The Command-line can be used to load arbitrary files as kernels and ramdisks (because stage 2 understands filesystems).
Each boot option in the GRUB configuration file is expressed in terms of GRUB command-line operations. Stage 2 contains the main part of the boot loader. Stage 2 is able to access many file systems.
Currently, Ext2, Ext3, ReiserFS, Minix, and the DOS FAT file system used by Windows are supported. To a certain extent, XFS, and UFS and FFS used by BSD systems are also supported. Since version 0.95 GRUB is also able to boot from a CD or DVD containing an ISO 9660 standard file system pursuant to the "El Torito" specification. Even before the system is booted, GRUB can access file systems of supported BIOS disk devices (floppy disks or hard disks, CD drives and DVD drives detected by the BIOS). Therefore, changes to the GRUB configuration file (menu.lst) do not require a new installation of the boot manager. When the system is booted, GRUB reloads the menu file with the valid paths and partition data of the kernel or the initial RAM disk (initrd) and locates these files.
menu.lst#The actual configuration of GRUB is based on three files that are described below:
/boot/grub/menu.lstThis file contains all information about partitions or Operating Systems that can be booted with GRUB. Without this information, the GRUB command line prompts the user for how to proceed (see Section “Editing Menu Entries during the Boot Procedure” (page 84) for details).
device.map#The /boot/grub/device.map file translates device names from the GRUB and BIOS notation to Linux device names.
grub.conf#The /etc/grub.conf contains the commands, parameters and options the GRUB shell needs for installing the boot loader correctly. GRUB can be controlled in various ways. Boot entries from an existing configuration can be selected from the graphical menu (splash screen). The configuration is loaded from the file menu.lst. In GRUB, all boot parameters can be changed prior to booting. For example, errors made when editing the menu file can be corrected in this way.
Boot commands can also be entered interactively at a kind of input prompt (see Section “Editing Menu Entries during the Boot Procedure” (page 84)). GRUB offers the possibility of determining the location of the kernel and the initrd prior to booting. In this way, you can even boot an installed Operating System for which no entry exists in the boot loader configuration.
GRUB actually exists in two versions: as a boot loader and as a normal Linux program in /usr/sbin/grub. This program is referred to as the GRUB shell. It provides an emulation of GRUB in the installed system and can be used to install GRUB or test new settings before applying them. The functionality to install GRUB as the boot loader on a hard disk or floppy disk is integrated in GRUB in the form of the commands install and setup. This is available in the GRUB shell when Linux is loaded.