HostOnNet Blog

How to restore GRUB

Looking for Linux Server Admin or WordPress Expert? We can help.

How to restore GRUB

It’s happened to almost every GNU/Linux and Windows dual boot user at some point: You have a nice installation GNU/Linux cross-booted with Windows. So far so good.

But then, at some point, you reinstall Windows, perhaps because you upgraded to a new version, or perhaps you just did it to “clean up” Windows, reinstalling the original system files to make it a little more stable. When you reboot, however, you’ll find that if you had LILO running from your hard disk’s MBR, it has been killed, and Windows has claimed the MBR as its own. How will you reinstall your boot manager so you can get into GNU/Linux?

here is small tutorial on how to reinstall your gnu boot loader in that case. I chose GRUB here as now a days it’s very popular and powerful too.

—-

Boot into the rescue mode using install CD1 by typing “linux rescue” at the boot prompt.

When it asks you if you want it to find your installation and mount it, let it by selecting “Continue”.

Once you get to the sh prompt chroot into you installation with:

# chroot /mnt/sysimage

If the disk you boot from is /dev/hda then you should be able to reinstall grub with:

# grub-install /dev/hda

Just remember to exit the chroot’ed shell before you reboot.

If you reboot by “Ctrl-Alt-Del” the installer will unmount your partitions.

Although it probably wouldn’t hurt to try to unmount as many as you can yourself with something like:

# umount /dev/hd?[1-9]*

Posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.