Using Grub
Grub (GRand Unified Boot loader) is a boot loader for Linux and can also load several other OS's. Using Grub is not difficult once you understand how it works.
To use Grub first you must find out if it is installed on your computer. Type man grub at a shell prompt, if the man page for Grub comes up then it is installed, if no man page then it probably is not installed. If you do not have Grub then you can download it from the internet. The Grub home page is www.gnu.org/grub or find it on freshmeat.net. The newest version at the time I am writing this is grub-0.92, compile and install as you would any other program.
After Grub is installed create a new subdirectory named grub in /boot
Then copy the files in
/usr/local/share/grub/i386-pc to /boot/grub
Next create a text file named menu.lst in the /boot/grub directory, menu.lst is the configuration file with the boot parameters for Grub. I have seen RedHat use a file named grub.conf as the configuration file and menu.lst as a symlink to grub.conf, which seems rather pointless to me. A typical menu.lst might look something like this.
Now let's break down the menu.lst and see what each line means.
Grub has it's own way of naming drives, hard disks are all hd, floppy disks are fd, device numbers start from zero, partition numbers start from zero and complete device names are enclosed in parentheses. Also note that Grub addresses only drives that are actually attached to the computer and dose not reserve spaces for drives that are not there. And Grub also ignores CD drives because it dose not consider them to be bootable hard drives.
For example:
|
Drive |
Hardware location |
Linux location |
Grub location |
|
Hard drive |
Primary master |
hda |
(hd0) |
|
none |
Primary slave |
hdb |
none |
|
Hard drive |
Secondary master |
hdc |
(hd1) |
|
CD Rom |
Secondary slave |
hdd |
none |
|
First primary partition |
Primary master |
hda1 |
(hd0,0) |
|
First extended partition |
Primary master |
hda5 |
(hd0,4) |
In the kernel line there are a couple of things to pay close attention to. If there is a separate boot partition as in (1) above then the kernel is actually in the root directory of that partition "kernel /vmlinuz". If there is no boot partition as in (2) above then the kernel is in the /boot directory of the root partition, "kernel /boot/vmlinuz".
Next tell the kernel where to find the root file system of the OS to be booted, "root=/dev/hdxx" using linux type drive and partition addressing when booting a linux system. Then add "ro" so it mounts the file system read only so fsck can preform it's checks, the kernel will later remount the system read write. Next add any boot parameters, separated by a space, that you wish to pass to the kernel, such as hdx=ide-scsi, or mem=xx, or whatever is needed for your system
Installing The Bootloader
Once the needed files including your custom menu.lst have been copied to /boot/grub you are ready to install the Grub bootloader. The bootloader can be installed to the MBR or to a primary partition that is set active or bootable. This example will install to the MBR of the first hard disk, this is the way to go if you also have Windows installed.
Before proceeding you should make sure you have a good working boot floppy in case something goes wrong. If you do not have one see Make A Boot Disk or skip down and make a Grub floppy first.
At a shell prompt, as root, type grub
if you get command not found try typing /usr/local/sbin/grub
you should then see something like:
Followed by:
At the Grub prompt do the following steps:
That's all there is to it, The Grub
bootloader is now installed.
Grub is a powerful tool with a command line
mode and lots more options than are covered here, for more information try:
A Grub Boot Floppy
Put a blank floppy in the drive but do not mount it yet:
This will low level format the disk then verify the format, and creat the file system, if the verify shows any errors then throw the disk away and try another.
Now mount the floppy and do the following:
note that some distros use "/floppy" instead of "/mnt/floppy". Now run Grub.
You now have a Grub boot floppy, test it to be sure it works properly.