I had a problem after reinstalling my windows on my dual boot laptop. I have windows XP and Ubuntu Gutsy. As usual i prefer using GRUB as bootloader, but the consequences is you will fail to load GRUB after formatting your Windows Operating System. As usual people still will rely on windows on some work to do because windows is still a dominan operating system nowadays.
But there is solution to repair GRUB after formatting your Windows. There is a native way and also simple way to repair those problem about GRUB. The first method is by using the native way of repairing GRUB. I would recommend this method method to people who know how to use terminal very well to do this method. Otherwise please use the second method cause it's easier.
Booting from any linux distro live CD and open the terminal.
- Open terminal by going to Application>Accessories>Terminal
- As usual you need to gain root access. Via live CD we know that we can do SUDO to gain temporarily access to root but we have a lot of command need root access so i prefer you change the root password so that we can use SU command to gain permenent root access. To change root password type SUDO passwd root. then set your root password. (Remember, this do not change your root password in your existing linux distro)
- Then we began to the repairing part. First use su command to gain root access. Then make a new directory by typing mkdir repair/ im using directory name .
- Next is we have to mount the default linux partition to your new directory by using mount /dev/hda7 /repair. (hda7 is the partiton which you have your linux distro installed)
- After that, we need to mount dev directory into /repair/dev by commiting this command. mount -o bind /dev /repair/dev
- After you finish doing all the above command successfully, then we may proceed by chrooting to the directory.
- Type chroot /repair
- Then type grub-install dev/hda to install a new GRUB bootloader.
- Then restart by typing shutdown -r now
You need to boot from any Linux Distribution Live CD, then run the terminal.
- Open terminal by going to Application>Accessories>Terminal.
- Then type SUDO grub in the terminal to access the GRUB.
- In the GRUB, type find /boot/grub/stage1
- You will have output like (hd0,6). hd0 is your hardisk of your linux, and 6 is the index number of your linux partition.
- Then type root (hd0,6) by assuming your output for step 3 is (hd0,6).
- Then type setup (hd0) and look at the output. If any problem occur then you need to check the step and the output for STEP 3.
- If there isnt any problem occur then we may proceed to the final step. Restart your laptop by typing shutdown -r now command.
If there is anything goes wrong then you should have your Grub back to normal when you restart your pc/laptop. But if there is anything wrong, and the GRUB cant load, i will encourage you to post it at http://forums.ubuntu.com.my. Have a nice day!