How to add Grub bootloader after Windows re-install on a dual-boot system
Guide Overview :
You have a dual boot system with Windows and Linux both on separate partitions. You decide to format the Windows partition and re-install Windows after a malware attack or just because Windows got too much cluttered. The Windows setup re-writes the MBR of primary partition so after re-installing Windows, you no longer have Grub loader and you can no longer boot into Linux. This guide tells you how to re-install Grub bootloader after reinstalling Windows on a dual boot system.
Requirements :
A bootable Linux live CD. For example, a Ubuntu CD. http://www.ubuntu.com/GetUbuntu/download
Instructions :
- Boot from the Live Linux CD.
- Choose an option that says something like "Try Linux without installing".
- After Linux desktop environment (like Gnome or KDE) is finished loading, open a Terminal window.
Under Gnome, open Terminal through, Applications menu -> Accessories -> Terminal.
Under KDE, open Terminal through, KMenu -> System -> Terminal Program (Konsole).
EDIT by Al1000: Please note that the remainder of this post does not apply to current Linux builds. Please see post #4 for up-to-date information
- In the terminal, type sudo grub.
- Next type, find /boot/grub/stage1 and press Enter. The output may look like hd0, 6
- Type root (hd0, 6). Note that we have to use whatever output we get from previous command. If you get hd0, 2, then type root (hd0, 2)
- Type setup (hd0) (again replace hd0 with the output of the find command) and press Enter. next type quit and press Enter to exit grub.
- Thats it, Grub bootloader is loaded again in MBR. Restart your computer.
Edited by Al1000, 02 April 2015 - 08:21 AM.
Added parenthetical, just to be safe :) - AA