Tuesday, March 2, 2010

All things you wanted to know about GRUB :

 

GRUB ( The Grub boot loader )

To restore Grub to the MBR:

CODE

$ su

< password >

# grub-install /dev/hda

To setup Grub or add new entries:

Note:

QUOTE (Info @ Grub)

Grub uses its own naming structure for drives and partitions, in the form of (hdn,m), where n is the hard drive number, and m the partition number, both starting from zero. This means, for instance, that partition hda1 is (hd0,0) to Grub, and hdb2 is (hd1,1). Grub doesn't consider CD-ROM drives to be hard drives, so if you have a CD on hdb, for example, and a second hard drive on hdc, that second hard drive would still be (hd1).

Also:

QUOTE (Info @ Grub)

Note that GRUB does _not_ distinguish IDE from SCSI - it simply counts the drive numbers from zero, regardless of their type. Normally, any IDE drive number is less than any SCSI drive number, although that is not true if you change the boot sequence by swapping IDE and SCSI drives in your BIOS.

Setup Grub:

CODE

# grub

First, tell Grub where to find the 'stage files' -- you can use Tab to show the alternatives: ( in this example hda4 )

CODE

root (hd0,3)

Now tell Grub to install into the MBR of hda:

CODE

setup (hd0)

And close with:

CODE

quit

Make or adapt the menu.lst: ( And new entries )

CODE

# vi /boot/grub/menu.lst

QUOTE (Text @ Screen)

# Begin /boot/grub/menu.lst

# By default boot the first menu entry.

default 0

# Allow 30 seconds before booting the default.

timeout 30

# Use prettier colors.

color green/black light-green/black

# The first entry is for Linux.

title Linux

root (hd0,3)

kernel /boot/vmlinuz root=/dev/hda4 ro

# If you want, a second entry for RedHat

title RedHat

root (hd0,2)

kernel /boot/kernel-2.4.20 root=/dev/hda3 ro

initrd /boot/initrd-2.4.20

# You wish to include Windows ?

title Windows

rootnoverify (hd0,0)

chainloader +1

Emergency

If things go really wrong and you get only a grub prompt you can still boot . . . .

For Windows:

CODE

grub> rootnoverify (hd0,0)

grub> chainloader +1

grub> boot

For Linux ( on hda4 like in example above ):

CODE

grub> root (hd0,3)

grub> kernel /boot/vmlinuz root=/dev/hda4 ro

grub> boot

Well, this was more or less all I can tell you on Grub. More info: http://www.gnu.org/software/grub

 
Things You Should Know About Linux !!!