0% found this document useful (0 votes)
84 views2 pages

Win 7 Install

This document provides steps to reinstall GRUB after installing Windows 7 by using a Live CD of the same Ubuntu version: 1. Boot from the Live CD, mount the root partition and boot partition (if separate) to /mnt. 2. Change the root to the mounted partition and update GRUB. 3. Install GRUB to the MBR disk using grub-install and reboot, removing the Live CD. This should restore boot ability to Ubuntu.

Uploaded by

sank_prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views2 pages

Win 7 Install

This document provides steps to reinstall GRUB after installing Windows 7 by using a Live CD of the same Ubuntu version: 1. Boot from the Live CD, mount the root partition and boot partition (if separate) to /mnt. 2. Change the root to the mounted partition and update GRUB. 3. Install GRUB to the MBR disk using grub-install and reboot, removing the Live CD. This should restore boot ability to Ubuntu.

Uploaded by

sank_prasad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

https://askubuntu.

com/questions/83771/recovering-grub-after-installing-windows-
7/83796#83796

You can re-install grub in the Master Boot Record using the LiveCD for you distribution version,
It goes like this:
Boot from LiveCD please try to use a LiveCD that has the same version of
Grub2 as the installed version
Mount the root of the installed Ubuntu at /mnt
Change root
Update grub
Install grub
Reboot
The above steps are from near the bottom of the Ubuntu Community Documentation of
Grub2
After booting from the liveCD ( select "Try Ubuntu" on the opening screen)
Then start up a terminal (dash, type-in terminal, )
It may be easier to open this web page while running LiveCD. Firefox should
allow you to do this.
Type in the terminal sudo fdisk -l - and enter your password if asked. That's a lower case L. Find
the installed Ubuntu partitions, (from mine with other disks snipped here):
me@mycomputer:~$sudo fdisk -l
...
Disk /dev/sde: 300.1 GB, 300089646592 bytes
255 heads, 63 sectors/track, 36483 cylinders, total 586112591 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3f5ebeb

Device Boot Start End Blocks Id System


/dev/sde2 138464296 586110975 223823340 5 Extended
/dev/sde3 * 2048 138463231 69230592 83 Linux
/dev/sde5 138464298 313460279 87497991 7 HPFS/NTFS/exFAT
/dev/sde6 313460736 317650943 2095104 82 Linux swap / Solaris
/dev/sde7 317652992 581922815 132134912 83 Linux
/dev/sde8 581924864 586110975 2093056 82 Linux swap / Solaris

Partition table entries are not in disk order


Find your Linux installation (Id=83, System=Linux0 then type in
sudo mount /dev/sde3 /mnt
but use your partition instead of /dev/sde3(my root partition is sde3, sde7 is my home
partition).
This is assuming that you do not have a separate /boot partition. If you do, you will need to also
mount it by typing
sudo mount /dev/sd /mnt/boot
where sd is the partition where you installed the separate boot directory.
ls /mnt - just checking to see if I got it right:
me@mycomputer:~$ sudo mount /dev/sde3 /mnt
me@mycomputer:~$ ls /mnt
bin cdrom etc initrd.img lib media opt root sbin srv tmp var vmlinuz.old
boot dev home initrd.img.old lost+found mnt proc run selinux sys usr vmlinuz
You should test to see if the boot directory is properly installed. Type in ls /mnt/boot and if it is
empty, the boot directory is not installed. It should look something like this:
me@mycomputer:~$ ls /boot
abi-2.6.35-30-generic initrd.img-2.6.35-30-generic System.map-2.6.35-31-generic
abi-2.6.35-31-generic initrd.img-2.6.35-31-generic vmcoreinfo-2.6.35-30-generic
config-2.6.35-30-generic memtest86+.bin vmcoreinfo-2.6.35-31-generic
config-2.6.35-31-generic memtest86+_multiboot.bin vmlinuz-2.6.35-30-generic
grub System.map-2.6.35-30-generic vmlinuz-2.6.35-31-generic
Then:
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt #change the root
sudo update-grub # now update grub
Example:
me@mycomputer:~$ sudo for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
me@mycomputer:~$ sudo chroot /mnt
me@mycomputer:~$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.0.0-13-generic
Found initrd image: /boot/initrd.img-3.0.0-13-generic
Found linux image: /boot/vmlinuz-3.0.0-12-generic
Found initrd image: /boot/initrd.img-3.0.0-12-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Microsoft Windows XP Professional on /dev/sdc1
done
Now to re-install grub in the MBR. You will need to know which disk your system boots from,
and find it in the fdisk -l listing you have already done. Then type in sudo grub-install
/dev/sdreplacing sd with the disk you will boot from.
me@mycomputer:~$ sudo grub-install /dev/sd
Then type in Crtl-D to exit chroot.
Then type in sudo for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done - as one line
me@mycomputer:~$ sudo for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done
If you mounted a separate /boot partition, type in sudo umount /mnt/boot
me@mycomputer:~$ sudo umount /mnt/boot
Then type in sudo umount /mnt
me@mycomputer:~$ sudo umount /mnt
Then type in sudo reboot to restart he system (remember to remove the LiveCD).
me@mycomputer:~$ sudo reboot
Hopefully, grub will be installed.

You might also like