How to repair LINUX Grub after installing Windows 7

After re-installing Windows 7  I faced a big problem :(. I was unable to  boot into my LINUX partition's , as my MBR (Master Boot Record) was written by Windows 7 and it didn't included my LINUX. So I asked many of my friend's they asked me to re-install LINUX. So I decided that I won't do it there might be any method to do this without destroying my LINUX. So I searched searched and found a method in the wild. I am gonna tell how to fix it in a right way. So let's start.


Note : Remember that you should have the original copy of the grub that is installed in your computer.

 1) First of all insert your CD ,Pendrive,etc. And boot into trial mode and open up the teminal. Type there
sudo su

2) Now type
    fdisk -l

This will list all you partation's on your hard disk Now the important work check which one is your LINUX partation. The Id of LINUX partation is 83.  

3) Now type
mount /dev/sdxy /mnt/
Replacing x by your actual device and y by your partation number. And then this command's.

mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
cp /etc/resolv.conf /mnt/etc/resolv.conf
chroot /mnt

 4) Now it's time to install our grub so type
grub-install --recheck /dev/sdx
Replace x by your actual device.
If everything goes well you will see this.


 5) Now type
reboot
And let your PC restart.

6) Now login to your LINUX OS and open up the teminal and type.
 sudo update-grub

7) Now that's all your are now done any problem ask in comment's.

Source : lancelhoff.com
Previous
Next Post »

2 comments

Write comments