GRUB Legacy

GRUB (GRand Unified Bootloader) is the default bootloader on Gentoo. This article discusses  (slot zero) also known as "Grub Legacy". Version 2, now available in the testing tree, is completely reworked and fundamentally a different bootloader — see GRUB2.

Installation
Install grub with:

Specifying slot 0 will make sure grub:2 will not get installed on world updates, unless you specifically install it.

Example of installing grub on an USB harddisk
The key to understand grub is to remember, in what environment grub is running.

Suppose you have 3 internal sata disk. Your gentoo is running on them and you want to install grub now on an external USB hard disk to boot a version of gentoo, which is installed on the second partition of the USB disk.

So the linux system has the following device names:

''/dev/sda, /dev/sdb /dev/sdc - internal drives

/dev/sdd - USB disk ''

The configuration of grub, which he reads while booting, is stored in /boot/grub/grub.conf or menu.lst, which is a symlink to grub.conf.

The kernel and the linux system of the USB drive is installed in the /dev/sdd2.

But when grub boots from the USB disk, for him it is the first harddisk.

So you would write in grub.conf

title gentoo USB

root (hd0,1)

kernel /boot/kernel-3.4.9 root=/dev/sdd2

In contrast, the kernel sees the USB disk as /dev/sdd, so the root= kernel parameter has to contain /dev/sdd2.

The same applies for the installation of grub. Here you give grub the names, under which linux sees it now. You would fire up grub, give him the root of the USB linux with

root (hd3,1)

and then tell him to install on the MBR of the USB disk with

setup (hd3)