Sunday, August 1, 2010

How to restore grub in linux?

I had a problem on my computer before. I accidentally damage MBR (Master Boot Record) on my PC and wasn't able to use my system for several days.

After a thorough research on the internet I was able to restore grub and boot back to my linux system.

Here are the steps I did:

1. Download a Live CD on you linux distro.
2. Burn it on a CD/DVD/USB.
3. Use it as first boot on you computer.
4. When you are on it, you can gain complete access to your lost Linux OS.
5. Mount you linux system into /mnt/my-linux-os
- su
- mkdir /mnt/my-linux-os
- mount /dev/sda{any number if you have partitioned your disk} /mnt/my-linux-os
6. Type 'grub-install /dev/sda' (to install Grub to the MBR of the 1st HD)
7. Restart and you should get the boot menu.

Or, you can also try this one:

1. Boot your Live CD.
2. Use terminal, login as root: su
3. type the command 'grub' and press enter
4. type root (hd0,0)
- or if your not sure the right one, you can type 'find /boot/grub/stage1'. This will output something like '....(hd0,5)'. use that one in this step.
5. type setup (hd0)
- just remove the comma and the next number.
6. type quit
3. Reboot.

No comments:

Post a Comment

Live Traffic Feed