Friday, October 23, 2009

Use previously installed Ubuntu after installing XP or Vista

This post explains in a quick fashion how to restore your Ubuntu grub after installing any windows verstion(XP, Vista, 7(dint try but shud work)).

Steps:
1. Install the windows version you need on any partition other than the one on which ubuntu is installed.

2. When you restart the PC you will be automatically logging into the windows version, so you would have to boot using a ubuntu live cd.

3. Once in the ubuntu live cd env open a terminal( application-> accessories -> terminal).

4. Type in as given below without the quotes
"sudo grub"

5. You will log in into a grub shell
grub>

6. Type in "root (hd0,0)"
followed by "setup (hd0)"

7. Keep on trying this with other values

eg.
root (hd0,1)
setup (hd0)

root (hd0,2)
setup (hd0)

root (hd1,0)
setup (hd1)


root (hd1,1)
setup (hd1)

until you get a successful message and not
"Cannot mount selected partition"

8. Once you get the message it means the grub was restored. Type "quit"

9. You will come out of the grub shell.

10. Now restart the machine. You will see the grub at the point of booting, with the ubuntu partition.

Setting up to boot windows.

1. Boot into the ubuntu partition by selecting the ubuntu from the menu.

2. Open a terminal following process given above and type in gksudo gedit /boot/grub/menu.lst

and edit it to boot to your windows partition.

Please post comments or queries if any.

No comments: