Grand Unified Bootloader (GRUB)

 < Day Day Up > 



The Grand Unified Bootloader (GRUB) is a multiboot boot loader that operates similar to LILO. With many distributions, it is now the default boot loader. GRUB offers extensive compatibility with a variety of operating systems. Users can select operating systems to run from a menu interface displayed when a system boots up. Use arrow keys to move to an entry and press ENTER. Type e to edit a command, letting you change kernel arguments or specify a different kernel. The c command places you in a command line interface, similar to LILO. Provided your system BIOS supports very large drives, GRUB can boot from anywhere on them. Linux and Unix operating systems are known as multiboot operating systems and take arguments passed to them at boot time. Here you can specify features like the kernel module to use for an IDE CD-R/RW drive (see Chapter 30). Use info grub to list detailed documentation or check the grub Man pages. You can use the Boot Configuration tool to select your default system or kernel as well as set the time out limit (accessible from System Settings menus as Boot Loader.)

GRUB configuration is held in the /etc/grub.conf file. You only need to make your entries and GRUB will automatically read them when you reboot. There are several options you can set, such as the timeout period and the background image to use. You can specify a system to boot by creating a title entry for it, beginning with the term title. You then have to specify where the operating system kernel or program is located, which hard drive and what partition on that hard drive. This information is listed in parentheses following the root option. Numbering starts from 0, not 1, and hard drives are indicated with an hd prefix, whether they are IDE or SCSI hard drives. So root(hd0,2) references the first hard drive (hda) and the third partition on that hard drive (hda3). For Linux systems, you will also have to use the kernel option to indicate the kernel program to run, using the full pathname and any options the kernel may need. The RAM disk is indicated by the initrd option.

title Red Hat Linux (2.4.21-20)       root (hd0,2)       kernel /boot/vmlinuz-2.4.21-20 ro root=/dev/hda3       initrd /boot/initrd-2.4.21-20.img

For another operating system such as Windows, you would use the rootnoverify option to specify where Windows is installed. This option instructs GRUB not to try to mount the partition. Use the imakeactive and chainloader+1 options to allow GRUB to access it. The chainloader option tells GRUB to use another boot program for that operating system. The number indicates the sector on the partition where the boot program is located—for example, +1 indicates the first sector.

title Windows XP       rootnoverify (hd0,0)       imakeactive       chainloader +1 

Windows systems will all want to boot from the first partition on the first disk. This becomes a problem if you want to install several versions of Windows on different partitions or install Windows on a partition other than the first one. GRUB lets you work around this by letting you hide other partitions in line, and then unhiding the one you want, making it appear to be the first partition. In this example, the first partition is hidden, and the second is unhidden. This assumes there is a Windows system on the second partition on the first hard drive (hd0,1). Now that the first partition is hidden, the second one appears as the first partition.

hide (hd0,0) unhide (hd0,1) rootnoverify (hd0,1)

A sample grub.conf file follows with entries for both Linux and Windows. Notice that kernel parameters are listed in the kernel option as arguments to the kernel.

/etc/grub.conf

start example
 grub.conf generated by anaconda # #boot=/dev/hda default=0 timeout=30 splashimage=(hd0,2)/boot/grub/splash.xpm.gz title Red Hat Linux (2.4.7-10)      root (hd0,2)      kernel /boot/vmlinuz-2.4.7-10 ro root=/dev/hda3 hdc=ide-scsi      initrd /boot/initrd-2.4.7-10.img title Windows XP      rootnoverify (hd0,0)      imakeactive      chainloader +1 
end example

Note 

Older Red Hat versions provide the older Linux Loader (LILO) as its boot manager. It performs the same kind of tasks as GRUB. You can modify your LILO configuration either by using an administration tool like Boot Manager (LILO-config) or by editing the /etc/lilo.conf configuration file directly. You can also configure LILO with the KDE Klilo2 tool.



 < Day Day Up > 



Red Hat(c) The Complete Reference
Red Hat Enterprise Linux & Fedora Edition (DVD): The Complete Reference
ISBN: 0072230754
EAN: 2147483647
Year: 2004
Pages: 328

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net