Fighting with computers

Computers are not always friendly.

Wednesday, September 06, 2006

Recovering your grub boot

If you use GRUB as your Linux boot loader (it happens the same with LILO) you may notice that your boot menu is gone after installing most flavors of Windows, including Windows XP SP2. One way to avoid this problem is to install Windows first and, later, to install Linux or BSD.

Another possible solution, more general, is to fix the boot that is gone. My favourite way is to use a Knoppix CD to boot your system in Linux. Then, as the root user I mount the hard disk partition that holds / and /boot and then to chroot to the first one (/). Now you can issue the install-grub command to get your partition table boot code fixed.

Example: Boot hard drive is /dev/hda and Linux / and /boot are in /dev/hda3 partition. Open a Knoppix terminal and type:


sudo bash
mount /dev/hda3 /mnt/hda3
cd /mnt/hda3
chroot ./ /bin/bash
grub-install /dev/hda
exit
reboot

That should be it. Do not forget to remove Knoppix CD before the next system boot.

0 Comments:

Post a Comment

<< Home