The DNetWorks

Menu
Skip to content
  • Home
  • About
  • Advertise
  • Buy Adspace
  • Hide Ads for Premium Members
  • Privacy Policy
  • Terms of Use
  • Tip Us
  • Write for Us

How to restore the GRUB 2 (GRand Unified Bootloader) on (Linux) Ubuntu after Windows 7 re-install for Dual boot systems

Posted on September 2, 2011 by Dhawal D

A lot of people use dual boot (Windows and Linux) on their desktops and laptops for various reason, some say Windows is not as secure but have to use it for software compatibility, We too agree that Windows is the traget of most of the virus that crashes the system. You are in a dilemma to either format the drive, which also happens to have the LINUX environment, and re-install Windows and Linux or somehow store the Linux installation and re-install Windows and restore it back, but how to go about doing the latter part is the question.

grub 2 restore after re-installation

Well, here is the answer

There are 2 simple step.

1. Download  Super Grub 2 Disk,  It’s .ISO file, so you need to burn into CD. After that, boot using Super Grub 2 Disk and select Detect OS. Super Grub will detect the Operating Systems installed on your hard disk. At least there should be a Linux install  and Windows 7 or whichever you have. Choose Linux (happens to be Ubuntu, in my case).
2. After You login to your Ubuntu. Open the terminal and type the following command :
sudo grub-install /dev/sda

Alternatively,

1).Using grub4dos
First download grub4dos from  here.
1.  For XP user,copy the file grldr (without quotes) from grub4dos package to  C:\.Editboot.ini  (hidden file in C:\) and add this line to the file:

c:\grldr="grub4dos"

For Vista/win7 user,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"

2.  Now,create  menu.lst  in root directory of C:,its content:

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

Restart 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/sda

2).Using Ubuntu 9.10 livecd or higher
Here assuming the Ubuntu partition is  sda7,and /boot partition is  sda6  (if you have a separate /boot partition).
Boot up ubuntu from the livecd,open terminal and run:

sudo -i
mount /dev/sda7 /mnt
mount /dev/sda6 /mnt/boot  #skip this one if not have a separate /boot partition
grub-install --root-directory=/mnt/ /dev/sda

If you miss grub.cfg  file,use following 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

3).Using the cd/usb boot up with grub
Boot up the cd/usb,press  c  in grub menu.Type:

grub>find /boot/grub/core.img
grub>root (hdx,y)   (previous command will output the x,y)
grub>kernel /boot/grub/core.img
grub>boot

After the boot command,you’ll go into grub2 menu.Select to boot up ubuntu,and run this command to restore grub:

sudo grub-install /dev/sda

 
Congratulations, you Grub has been restored.

 

Dhawal D

 

This entry was posted in Featured, How to's, Tutorials and tagged copy, disk, drive, file, img, installation, ISO, login, menu, nbsp, partition, reason, root, sda, software, sudo, terminal, type, Ubuntu, Unified. Bookmark the permalink.

Post navigation

← Here’s presenting Samsung Tab 7.7 – Features and specification.
How to connect Samsung Galaxy S2 to the PC via USB →

Search what you’re looking for

    September 2011
    M T W T F S S
     1234
    567891011
    12131415161718
    19202122232425
    2627282930  
    « Aug   Oct »
Proudly powered by WordPress | Theme nuwhite by Mkhuda