A few words of thanks would be greatly appreciated.

GRUB - The structure of configuration file

The configuration file of GRUB


The GRUB configuration file is located in /boot/grub/grub.conf ou /boot/grub/menu.lst

Example of a standard configuration

In general the structure of /boot/grub/grub.conf or /boot/grub/menu.lst is as follows (Don't take into account the existing comments).

default N
timeout sec
color   color1 color2

# Configuration for the OS on which Grub is installed

title           The OS label 
root            (hd<disc>,<partition>) 
kernel          /boot/vmlinuz-2.x.x.xx root=/dev/hdLN options
initrd          /boot/initrd.img-2.x.x.xx
# From here to edit for other OS

# For GNU/Linux
# For each OS added in Grub add it to write the next block

title           The additional OS label 
root            (hd<disc>,<partition>) 
kernel          /boot/vmlinuz-2.x.x.xx root=/dev/hdLN options
initrd          /boot/initrd.img-2.x.x.xx
rootnoverify    (hd<disc>,<partition>) 

#For Windows 

title           The OS label 
root            (hd<disc>,<partition>)  
chainloader     +1

Defaults Parameters

  • default N - is the system that starts by default with the bootloader dual boot system
  • sec timeout - the timeout in seconds before the automatic startup
  • color color1 color2 - The background color

1. Addressing

<disc> and <partition>and are numbered from zero, so there is no hda, hda1, etc. ..


  • 1st partition of 1st disk (hd0, 0)
  • 2nd partition of 1st disk (hd0, 1)
  • First partition 2nd disk (hd1, 0)

2. Title

  • title - is a label that is displayed in the GRUB boot

Ex: Debian GNU/Linux, kernel

3. Root

root (hd<disc>,<partition>)

Activating a partition as boot partition.

4. Kernel

kernel /boot/vmlinuz-2.x.x.xx root=/dev/hdLN options

Loading the kernel:

- If the partition contains activated at startup contains / boot (thus a dedicated partition), use:
kernel /vmlinuz-2.x.x.xx root=/dev/hdLN options

the root=/dev/hdLN argument means the root system

L is a letter representing the disc (a for the first disk, b for second, etc. .., and N is the partition number)


ro for read-only
mem = 'size'

Here is a link : www.tldp.org/HOWTO/BootPrompt-HOWTO.html

5. Initrd

initrd /boot/initrd.img-2.x.x.xx

The kernel mounts a temporary root system using a compressed image

- If the partition activated at startup contains / boot (thus a dedicated partition), use:
initrd /initrd.img-2.x.x.xx

6. Rootnoverify

rootnoverify (hd<disc>,<partition>)

Activation of the boot partition but without mounting it
Use it for the OS for which we must add the configuration file.

7. Chainloader

chainloader +1

Loading a file or blocks that act as secondary loader
Used to activate Windows.

Important notes

When partitioning the drive, note on a piece of paper all the manipulation performed. It can be used to edit the Grub configuration file later.

Some systems use vmlinuz to refer to the kernel. In fact it is a symbolic link to the kernel.
Similarly initrd will be a symbolic linkfor initrd.img-2.xxxx.
To know which version of the OS kernel :

uname -r

To see which kernel points to vmlinuz

ls -l /boot/vmlinuz

Grub also has a small shell that can be used to test the commands you want to put in the configuration file.

  • To find out about Grub commands at startup you must press the C button and type "help" in the mini shell.
  • To get help for any command you must type help + command
  • To edit the file make use of a text editor in graphics mode (gedit, kedit, kwrite, xemacs) or in console mode editor (vi, vim, emacs, mc)


A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « GRUB - The structure of configuration file », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).