Yesterday, I removed my Debian installation and tried installing Ubuntu 11.04. I use dual boot with windows 7 on the other side, I had to be very careful since i have all my works on windows drives. In the installation process, everything went right until copying the files to hard disk from the installation CD. While copying the files, I/O read error occurred and the installation failed. Already I have deleted the Debian installation which had the boot loader, now I ended up with the GRUB rescue prompt and i lost my windows7. Below i have listed the steps that i followed to get back my windows, people facing kind kind of issues can make use of it.
To recover the windows 7 installation, we need windows 7 installation disk. Now try booting the system from installation DVD and choose 'System Repair'. This will lead you to a command prompt where you can type below commands.
Your damaged GRUB will now be replaced with a new master boot record and the computer should now be able to boot properly. Note that you may also want to run the fixboot command to repair the boot sector with a new one. But there exist a problem in this method, if you don't have any other operating systems installed then this method will be do, but if you have other operating system running, window MBAR can't sense that OS and that can't be recovered. So in those situation we need a Ubuntu Live disk.
Now boot the system with the Ubuntu live cd and the package that it is to help us is LILO(LInux LOader). In the live environment, the lilo will not be pre-installed in Ubuntu. So first install the package and restore the loader.
sudo apt-get install lilo sudo lilo -M /dev/sda mbr
And that's it. After running these commands, you can get windows loaded in your system with the other OS installation if available. This is a simple process, but Ubuntu supports only GRUB as boot loader hence this may cause some problem with Ubuntu boot. So this method can be used when you want to get windows restore without having a windows installation drive.
If you want to recover windows with GRUB loader, we can use the GRUB rescue method. After booting the system with Ubuntu live disk, in the terminal use.
Normally grub will not be installed so use
sudo apt-get install grub
This command will install the grub and on executing the grub command will lead to grub prompt there you can type the following lines to get the boot loader.
> root (hd0,0) > setup (hd0)
Then exit the prompt and restart the system, now GRUB will be reinstalled with all the active operating systems without any issue.