How to Restore Grub on a Multi-boot Computer

I have made my Ferrari 3400 a triple-boot machine. I have Windows XP, Vista RC2 and FC6. The proper way to set it up is to install the XP first, then Vista and finally FC6. Therefore, I can use Grub as my boot manager to switch between Linux and Windows. However, if you decide to install or re-install Windows, the grub is gone and you can boot to Windows only.

Here are the procedures I use to restore grub.

  1. Boot the machine using a KNOPPIX live cd.
  2. Bring up a root shell.
  3. My main Linux partition is on hda8, so I use this command to mount it.
    mkdir /mnt/hda8

    mount -o dev,rw /dev/hda8 /mnt/hda8
  4. I have a separate boot partition hda6, so I need to mount it, too. You can skip this step if you don’t have it.
    mount -o dev,rw /dev/hda6 /mnt/hda8/boot
  5. Finally, I run grub-install to re-install
    grub.
    grub-install --root-directory=/mnt/hda8 /dev/hda

This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.


5 Comments

  1. Dear all,

    How to restore grub . After type linux rescue will go to shell like this sh-05b# here i type chroot /mnt/sysimage its showing ” chroot: cannot change root directory to /mnt/sysimage : no such file or directory” i dont know what is the problem plz help sombody to this problem

    regards

    deepu

  2. What bootable CD did you use? Have you tried to use Knoppix CD? If you use Knoppix, you don’t have to type linux rescue, just hit enter to boot normally.

  3. i found an easier solution to the grub not being shown at the first boot after installing fc6:

    use fc6 dvd to boot

    press F5 for linux rescue

    type linux rescue, press enter

    now, at the prompt, type:

    grub — to enter grub program

    root (hd1,0) — my fc6 is on 2nd hdd, 1st partition

    setup (hd0) — my xp runs on 1st hdd

    quit

    press ctrl-alt-del to reboot, et voila ๐Ÿ™‚

    hope that helps

  4. The above method has the advantage of not being distro specific. I personally find it much simpler too. All one has to do is mount the device (easily done by gui) and the grub install is just one measly command on the root console. (Knoppix is the real swissknife for any linux enthusiast/administrator).

Leave a Reply