Booting GNU/Linux - GRUB
- 1 Advantages Of Using GRUB
- 2 Installing GRUB
- 3 GRUB Configuration
- 4 Booting Other Kernels / Distributions / Operating Systems Via GRUB
Page précédente : Démarrage avec Lilo
Page suivante :
Index de la section ~~Administration avancée du système~~ - Index de la Base de Connaissances
Advantages Of Using GRUB
~LiLo (Linux Loader) is the standard GNU/Linux boot loader, usually installed at system installation time. Despite its name, you may use it for booting other operating systems on the same or other system disks, too. Since ML 7.1, you can use GNU GRUB, the GRand Unified Bootloader, instead. It has several advantages over ~LiLo:- The possibility to edit boot parameters at boot time. This is very handy if, for example, you play with some parameters that are essential at booting. Let's say that you modify the NOACPI option in ~LiLo and thereafter you are unable to get into linux. As you cannot modify boot parameters at boot time, if you use ~LiLo you will need a bootable disk, mount the partitions and change the parameters.
- A small boot shell.
- Support for the 'hidden' flag which comes in handy, if you have multiple MS-DOS/Windows primary partitions.
- The configuration file ('/boot/grub/menu.lst') allows changes 'on the fly'. No extra installation step after editing needed.
- Booting disk-less clients over a network.
Installing GRUB
First check if GRUB is already installed withrpm -q grub
urpmi grub
grub-install /dev/{device}
{some text} (fd0) /dev/fd0 (hd0) /dev/hda
(fd0) /dev/fd0 (hd0) /dev/sda
(fd0) /dev/fd0 (hd0) /dev/sda (hd1) /dev/hda
grub {some text} grub> root (hdw,x) {some text} grub> setup (hdy,z)
Example 1: Install GRUB to the master boot record of the first IDE disk. The '/boot' directory is on the same disk, on /dev/hda3.
grub> root (hd0,2) grub> setup (hd0)
grub> root (hd1,0) grub> setup (hd1,0)
grub>
help
help {command}
init
kernel
kernel (hd0,0)/boot/vmlinuz root=/dev/hda1
find /boot/vmlinuz
boot
GRUB Configuration
GNU GRUB's configuration file is '/boot/grub/menu.lst'. You can edit or create it either by loading it into an editor, or by using the '~DrakBoot' tool in '~DrakConf' (Mandrake Control Center). In contrast to '~LiLo', you don't have to run any command after editing. To get an overview on available GNU GRUB commands, just start a GNU GRUB shell as 'root' by typinggrub
help
help {command}
info grub
timeout 5<br> color black/cyan yellow/cyan<br> i18n (hd0,0)/boot/grub/messages<br> keytable (hd0,0)/boot/us.klt<br> default 0- to wait five seconds before booting the default entry,
- which colors to use in the boot menu,
- which boot messages file to use,
- which key table to use (generated by ),
keytab-lilo.pl {key map} > {file}
- which entry to boot by default.
(hd0,0)
Partition numbering also starts with null. Note that the first logical partition is always '4', regardless of how many primary partitions are actually on the disk. An entry for Linux would look like this:
title Linux<br> kernel (hd0,0)/boot/vmlinuz root=/dev/hda1
title
kernel (hd0,0)/boot/vmlinuz-{...}
root=/dev/hda1
init
init
title Linux<br> kernel (hd0,0)/boot/vmlinuz root=/dev/hda1 PROFILE=dhcp
title Linux<br> kernel (hd0,0)/boot/vmlinuz root=/dev/hda1<br>initrd (hd0,0)/boot/initrd.img
Booting Other Kernels / Distributions / Operating Systems Via GRUB
Other Kernels
Create another entry like the one above (with a different 'title', of course).Other Linux Distributions
Install ~LiLo to the boot sector of the root partition (not the MBR) of that distribution. Add an entry like the one discussed in the next paragraph to your '/boot/grub/menu.lst' on your Mandrake Linux system.Other Linux Distributions on an USB hard drive
If you want to boot a distribution installed on an USB drive and if the bios of your computer don't allows to boot on USB, one can build a custon initrd image including modules needed to mount partitions of your USB hard drive. This can be done using the program mkinitrd with root privileges and can be done booting in rescue mode using an instalation CD or even from your primary linux distribution. You have to mount the partition containing the root partition of the distribution installed on USB, link the /dev of this partition to the one of your running distribution, then you can chroot the distribution on USB, assuming directory /mnt/hdusb1 already exist, this can be done with root privileges using the following three commandlines:mount /dev/sda1 /mnt/hdusb1<br>mount -o bind /dev /mnt/hdusb1/dev<br>chroot /mnt/hdusb1
mkinitrd ––preload=ehci-hcd ––preload=usb-storage ––preload=scsi_mod ––preload=sd_mod /boot/usbinitrd.img 2.6.8.1-12mdk
cp /mnt/hdusb1/boot/vmlinuz /boot/vmlinuz-usb<br>cp /mnt/hdusb1/boot/usbinitrd.img /boot
title linux_on_USB <br>kernel (hd0,0)/boot/vmlinuz-usb root=/dev/sda1 resume=/dev/sda6<br>initrd (hd0,0)/boot/usbinitrd.img
Other Operating Systems
An entry for operating systems like DOS, ~BeOS, Win9x/NT or OS/2 looks a bit different:title Windows<br> rootnoverify (hd0,0)<br> makeactive<br> chainloader +1
rootnoverify (hd0,0)
makeactive
chainloader +1
Onto floppy
(Contributed by Marc Indekeu) The following is a grub install to a floppy for emergency purposes. It's done with grub installed on my MDK 8.1 system and '/mnt/floppy' is the mountpoint for my floppy.- Insert empty floppy into drive and create a directory with the name 'boot' on that floppy.
- Copy the contents of your '/boot/grub' directory to that floppy:
- Start the 'grub' configuration shell as 'root' with:
- Inside the shell, run these two commands to make the floppy bootable:
setup (fd0)
- Enter quit to exit the grub shell.
info grub
Related Resources:
info grub
Multi-Boot with GRUB mini-HOWTO Revision / Modified: Sept. 19, 2001 / May 14, 2002
Author: Tom Berger Legal: This page is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.
Booting GNU/Linux - GRUB
Version 1.19 last modified by ptyxs on 26/11/2006 at 15:31
Version 1.19 last modified by ptyxs on 26/11/2006 at 15:31
Document data
- Lost account?
- Join the community, be part of the Club: it's free!
- Get the PWP Download Subscription!



