Saturday, September 12, 2009

Grub install

I used to install both Linux as well as Windows
Often I have to do grub-install

Procedure to do grub-install

Boot with the Linux CD

Using "linux rescue" mode go to Rescue mode

do
chroot /mnt/sysimage
grub-install /dev/
Eg: grub-install /dev/sda

If you are adding a new harddisk with some other OS inside it, you can make an entry to the grub.conf file and boot from that also

Usually first harddisk will be detected as "hd0" in the device.map file
So if you are adding a new harddisk it might not get detected.
You need to do grub-install /dev/sda --recheck for mapping the new harddisk also

In grub.conf file
root is used to specify from wchih harddisk/partition the system has to boot

root (hd0,3) means , you need to boot from the partition number 4 (i.e 3 + 1 ) , in the device mapped to hd0 in device.map file


Recently when i connected a new harddisk with windows OS, to a machien which is having another harddisk with RHEL4, i was not able to boot windows
I had to give entries for Windows like this to boot

title Windows
map (hd1) (hd0)
map (hd0) (hd1)
rootnoverify (hd1,0)
makeactive
chainloader +1
boot

Am not sure regarding what this map does, but it worked for me