Subscribe:

Thursday, July 21, 2011

Restore Grub After Installing Windows

This tutorial will explain how to restore Grub after installing Windows 7/Vista/Xp.If you are using dual boot PC with windows,Ubuntu for some reason you reinstall your windows now you may not see your grub 2 is loading because your windows installation might have been over written MBR (Master boot record).
Method 1

Using Ubuntu 9.10 livecd

First you need to download Ubuntu from Ubuntu site

In this tutorial we are assuming the Ubuntu partition is sdc3,and /boot partition is sdc2

Note:- You need to replace sdc3,sdc2 with your partitions.You can check your partition table with fdisk -l

Now Boot up ubuntu from the livecd,open terminal from Applications menu -> Accessories -> Terminal and login as root using the following command

sudo -i

mount /dev/sdc3 /mnt

mount /dev/sdc2 /mnt/boot

grub-install --root-directory=/mnt/ /dev/sdc

If you are not having “grub.cfg” file,use following contents to recreate

mount --bind /proc /mnt/proc

mount --bind /dev /mnt/dev

mount --bind /sys /mnt/sys

chroot /mnt update-grub

umount /mnt/sys

umount /mnt/dev

umount /mnt/proc

exit

Method 2

Using GRUB for DOS

GRUB4DOS is an universal boot loader based on GNU GRUB. It can boot off DOS/LINUX, or via Windows boot manager/syslinux/lilo, or from MBR/CD. It also has builtin BIOS disk emulation, ATAPI CDROM driver, etc.

Download GRUB for DOS from here

For XP Users

copy the file grldr from grub4dos package to C:\.Edit boot.ini (hidden file) and add this line to the file:

c:\grldr=”grub4dos”

For Windows7/Vista Users

Copy the file grldr,grldr.mbr to C:\.Create boot.ini file in the root directory of C:,copy and paste following into this file.

[boot loader]
timeout=0
default=c:\grldr.mbr
[operating systems]
C:\grldr.mbr=”Grub4Dos”

Now,create menu.lst in root directory,with the following content

timeout 0
default 0
title grub2
find --set-root /boot/grub/core.img
kernel /boot/grub/core.img
boot

Now restart your computer,and select boot from Grub4Dos.Then select boot up Ubuntu in grub menu.
Once login,use this command to install grub into mbr

sudo grub-install /dev/sdc

Note :- Replace sdc with your partiton

0 comments:

Post a Comment