Thursday, August 30, 2007

Alter your grub (boot loader) settings thru command line (linux)

For those who ask 'what is grub', its a boot loader. if you ask what is a boot loader, try this.

To alter grub settings you have to modify this file /boot/grub/grub.conf (this is for centos. i guess it should be the same for red hat as well).

I use CentOS at home. My boot loaded showed as the following.

1. CentOS
2. Windows

I had set it initally to boot windows by default (This I did while installing CentOS). Then I wanted to load Linux (CentOS) by default. So I had to edit grub.conf.

This was my intial content of grub.conf

title LINUX [CentOS-4 (2.6.9-11.EL)]
root (hd0,6)
kernel /vmlinuz-2.6.9-11.EL ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-11.EL.img
rootnoverify (hd0,0)
chainloader +1

Notice the intial variable 'default'. That denotes the title number. Since Windows is the second title, it has been denoted as default=1 (first is always denoted by 0 in computers). So if you want your first title (Linux-CentOS) to get loaded by default, change the setting as default=0, this is what I did. Now my system loads CentOS by default.

No comments: