Monday, April 26, 2010

Deleted Linux partition! How to get back into Windows?

Recently one of my computers' Linux partition was deleted by mistake. As the Linux partition held the multi-boot information, it made the computer stuck at grub prompt with no way of knowing where to load the OS images from. I think that is known as grub stage 2. I was able to find grub commands and successfully booted into Windows XP. So, if Linux partition of your multi-boot system is inadvertently deleted and you are stuck at grub prompt without access to Windows cd, then try this list of commands at grub prompt

grub> root(hd0, 0)
grub>chainloader +1

Note the first command " root(hd0, x) "here x could be a different number on your system...mine worked for 0.
This booted the Windows XP on the computer. But each time the computer is restarted after this, it's stuck at grub prompt and you have to follow the same list of commands. Another search and I found and installed a very nice utility called "mbrfix". Booted Windows and ran the utility; it created the master boot record (MBR) for Windows and fixed the problem and I could reboot without any problem.

Alternatively, I have read that if you have access to Windows cd, booting from it and running command "fixmbr" also does the trick.