Search

Working with grub.conf configuration file

A sample grub.cof file is shown below. The lines beginning with a "#" are comments.

### Beginning of grub.conf ###

# 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,0)
#          kernel /vmlinuz-version ro root=/dev/sda2
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu

#####First Operating System#####

title Red Hat Enterprise Linux Server (2.6.18-8.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quiet
        initrd /initrd-2.6.18-8.el5.img

#####Second Operating System#####

title RedHat Operating System 2
        root(hd1,0)
        kernel /vmlinuz-2.6.18-8.el5 ro root=/dev/sdb2 rhgb quiet
        initrd /initrd-2.6.18-8.el5.img

### End of grub.conf ###

 

The grub.conf configuration file is explained in detail below.

• The default=0 directive points to the first stanza, which is the default Operating System to boot.

• The timeout=5 directive specifies the time, in seconds, for GRUB to automatically boots the default operating system.

• The splashimage directive locates the graphical GRUB screen.

• The hiddenmenu directive means that the GRUB options are hidden.

A stanza begins with a titile, (the text to be displayed in boot menu for selecting the Operating System) and the next three lines specify the location of the /boot directory, the kernel, and the initial RAM disk (The initial RAM disk (initrd) is an initial root file system that is mounted prior to when the real root file system is available), respectively.

root (hd0,0) - Specifies the boot directory is in first hard disk, first Partition.

kernel /vmlinuz-2.6.18-8.el5 ro root=LABEL=/ rhgb quiet - Specifies the kernel location which is inside the /boot folder. This location is related to the root(hd0,0) statement. The "ro" option specifies the kernel should be opened as read only to protect it from any accidental writes from the initial RAM disk and "rhgb" enables the RedHat Graphical boot option.

initrd /initrd-2.6.18-8.el5.img - Initial RAM disk.

Related Tutorials
• GRUB (GNU GRand Unified Boot loader)
• How to password protect GRUB (GNU GRand Unified Boot loader)
• Linux Rescue Mode (Linux Rescue Environment)
• init process and Linux runlevels
• inittab configuration file
• Working with inittab configuration file
• inittab format