0% found this document useful (0 votes)
50 views

After Reinstalling Windows in The Computer Dual Boot With Both Windows and Ubuntu Linux

This document provides instructions for restoring GRUB 2 after reinstalling Windows and dual booting with Ubuntu Linux. It describes three methods: using Ubuntu LiveCD/LiveUSB with boot-repair, using grub4dos to boot into Ubuntu from Windows and reinstall GRUB, or using an Ubuntu LiveCD/USB to mount partitions and reinstall GRUB directly. The recommended method is to use boot-repair from a Ubuntu Live environment for an easy one-click repair of GRUB.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

After Reinstalling Windows in The Computer Dual Boot With Both Windows and Ubuntu Linux

This document provides instructions for restoring GRUB 2 after reinstalling Windows and dual booting with Ubuntu Linux. It describes three methods: using Ubuntu LiveCD/LiveUSB with boot-repair, using grub4dos to boot into Ubuntu from Windows and reinstall GRUB, or using an Ubuntu LiveCD/USB to mount partitions and reinstall GRUB directly. The recommended method is to use boot-repair from a Ubuntu Live environment for an easy one-click repair of GRUB.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

After reinstalling Windows in the computer dual boot with both Windows and Ubuntu

Linux,you need restore grub because mbr has been rewritten.This tutorial shows how to
restore grub 2.
Update:Today I ghost my XP system,but after restore grub,I cannot boot into XP by
clicking the old windows option in grub menu.So youd better to run this command to
renew the grub2 boot list after trying following method:
sudo update-grub

0.) Using Ubuntu LiveCD/LiveUSB and boot-repair (gui tool).


If you have the LiveCD or LiveUSB you installed Ubuntu from, insert into your machine
and boot from it. Then run 3 commands into terminal (Ctrl+Alt+T) to install boot-repair:
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair

If you dont, directly download boot-repair.iso file and burn into liveCD or liveUSB
(UNetbootin) then boot from it.
Open boot-repair, click Recommended repair to repair grub2 with one click.
ClickAdvanced options for details.

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,youll go into grub2 menu.Select to boot up ubuntu,and run this
command to restore grub:
sudo grub-install /dev/sda

You might also like