November 3, 2009 · General · Email This Post
Share

If you're new here, you may want to subscribe to my RSS feed and if you have questions related to your ubuntu system post question to our forums. Thanks for visiting!

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

  • Share/Bookmark

Related Articles

7 Comments to “How to restore Grub boot loader after installing Windows”

  1. frank says:

    i found it easiest to first save the mbr to a file on a memory stick, and then recover it after booting from a live cd.
    google “save restore mbr +dd” - the instructions by Randy Cooper worked just sterling for me.
    just remember not to destroy your disk… =)

  2. Christian says:

    I think this should also work for migrating from LILO to Grub if you installed Ubuntu from the Alternate CD.

  3. Fikret says:

    Here is a simple way

    http://linuxogrenmekistiyorum.com/2009/04/05/grubu-yeniden-kurmak/

    Only five command

    #
    sudo grub
    #
    find /boot/grub/stage1
    #
    root (hd0,5)
    #
    setup (hd0)
    #
    quit

  4. Christian says:

    @Fikret:

    Ääääääh, ja. Ich mag zwar n Berlin-Kreuzberg wohnen, aber ganz so einsichtlich war das für mich nicht.

    Wird aber schon stimmen. Danke ;)

  5. Christian says:

    Ehm, sorry. Too early with a coffee mug in my hands. Been reading in English and writing in German ;)

    Grab the translation here: http://bit.ly/30cNwi

  6. Ole says:

    @Fikret:
    Ha ha. Your way is for grub1. This for grub2.

  7. Red R says:

    Hi, My Distro is Fedora 11 dual with Windows XP but I’m sure Ubuntu Grub is just the same. I could be mistaken but it seems to me you are all really going about this the hard way; me I’m just lazy, go here: http://www.supergrubdisk.org/ download the Supergrub boot disk of your choice (CD,USB Flash or Floppy) boot your system with it read what it says and press number 1 (usually) on the menu and that should fire up your usual session and when you close down and restart the Grub boot menu should be back to where it was before Windows trashed it :o )

Leave a Reply