Sunday, July 20, 2008

Recover Dual Boot XP, Ubuntu 8.04 (Hardy Heron)

Issue: I needed to reinstall Windows XP on a dual-boot machine. No new partitions were needed, there were 2 O/S partitions - one with XP and the other with Ubuntu. After reinstalling Windows - the machine would simply boot into Windows XP (no dual-boot menu)

Solution: Boot from Ubuntu LiveCD - choose to demo. Then open terminal.


rohit@rs-dimension:~$ sudo -i
[sudo] password for rohit:
root@rs-dimension:~# grub

[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]

grub> find /boot/grub/stage1
(hd0,4)

grub> root (hd0,4)

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,4)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.



This setup grub in hd0 on my system - bringing back the boot menu. Simple