What is Grub

Grub stands for Grand Unified Boot Loader, which is responsible to load the kernel into the memory and boot your Linux operating system. Grub can load other operating systems like window xp/2000/2003/2008, Mac OS, Free BSD,Net BSD as well.

Grub is the replacement of older Linux bootloader ‘LILO’.

Grub is a great boot loader. Grub has interactive command interface and it can boot from the network. You don’t need to write changes in grub every time. Grub offers you to boot with unlimited OS.

To better understand how your system starts,we should have good understanding of grub. Now have a Look at the grub configuration file ‘grub.conf’.

Note: This is a sample grub file of a dual boot system.

# grub.conf generated by anaconda
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,4)
# kernel /vmlinuz-version ro root=/dev/sda2
# initrd /initrd-version.img

title CentOS (2.6.18-128.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.18-128.el5.img

title other
rootnoverify (hd0,0)
chainloader +1

The very first line of this grub.conf says that this file is created by anaconda,which is CentOS installation program. The next line says that the changes made in grub.conf need not to be written into the MBR,because this file is significantly link to the grub pointer that is apparently already installed in the MBR.
Remember the next line “NOTICE” appears only if you have created a separate partition for /boot. The next entry ‘root(hd0,4)’ means that /boot is on the fifth partition of your first hard drive. Remember the ‘root(hd0,4)’ directory uses numbering from 0 to so on.
Default=0 means that the first OS listed in this file will be booted automatically. In this case, CentOS will boot automatically. If we change this value to 1,the next OS will boot automatically.
Timeout=5 means that we get five seconds to select any one OS to boot when our system starts up. If you change this value to 8,it means we get eight seconds now to select our OS choice.
Splashimage directive points to the location of splash image which we see in the background,when your system starts up.
Hiddenmenu means that grub options are hidden by default.

title CentOS (2.6.18-128.el5) tells the name of operating system and its version

Next three lines tells us about the location of /boot,kernel and initrd.

root (hd0,0)
kernel /vmlinuz-2.6.18-128.el5 ro root=LABEL=/1 rhgb quiet
initrd /initrd-2.6.18-128.el5.img

As we have discussed earlier, root (hd0,0) means that /boot is on the fifth partition of your first harddrive. kernel is defined by vmlinuz-2.6.18-128.el5, in read only mode(ro),so that it can be saved from any disaster writing from initrd. The root directive is combined with the / label.& the rhgb quiet directive hiddes the boot message by default.

The next line tells us about initrd and its version.

title other refers to the second OS installed in our System.
rootnoverify (hd0,0) means that the OS will not try to mount the windows partition in linux style.
Chainloader +1 directive points to the first sector of other OS.

You can leave a response, or trackback from your own site.

Leave a Reply