agaskar.com

Reverting to XP from a dual-boot GRUB.

My old laptop (a Dell Inspiron 2200) was configured to run XP and Debian Etch. It turns out that I was using Photoshop and Illustrator enough that I rarely booted into Linux

Tangentially: I've since found that VMware on a sensibly speedy machine works fantastically: I've got an Ubuntu install running alongside XP, and it's very convenient to be able to switch into an Linux environment without needing to reboot. Out of 3 GB of RAM, it has 1 GB dedicated to it and 10 GB diskspace. Performance of the VM seems fine (I've turned on paravirtualization, fwiw) and seems to have no noticeable effect on my day to day usage of XP (although the only memory hungry XP app I use is Firefox).

As I'm using the Gateway m6824 as my primary machine now, my older laptop travels with my girlfriend to her job; due to the awkward partitioning decisions I made (out of a 40GB machine, I allotted 10GB for each primary boot, and then used the remaining 20GB space for file storage and Windows paging) it was starting to become troublesome for her to run. After the jump, I'll go into detail about how I rolled back to a pretty vanilla XP install on one partition without a reinstall.

Typically in this situation I would just wipe the disk and reinstall XP -- enough of my daily output lives on servers that there's little on my HD that is necessary to backup and port. However, in this case, it was necessarily to retain some of the application settings; particularly for Outlook and a few wireless networks.

The obvious choice here was Partition Magic, but it refused to remove the Linux partition, bailing out with a #510 error (The version of the file system is not supported). Although the Partition Magic website states "An updated version of PartitionMagic is required to operate on this new version of the file system. Visit www.symantec.com for information about updated versions of PartitionMagic.", this does not seem to be the case.

I assumed Partition Magic refused to remove the Linux partition because I had GRUB loaded into my MBR (this turned out to be incorrect), so I set about finding a way to reinstall the Windows MBR. This page provides a good overview of removing a Linux partition. My options seemed to be either to use mbrfix (freeware, no reboot req'd), or use my original XP install disc to run a recovery console.

I tried MBRFIX first (no reboot? no looking around for Windows discs? Sure!) but received "Error 32". I was unable to find any documentation that explained this error so it was necessary to resort to using Windows Recovery Console (which, it should be noted, is only available on XP discs that are NOT built for unattended installs).

After booting into the Windows Recovery console (boot from the Windows CD and then hit R at the Windows Setup screen -- you'll be prompted for your administrator pass and then dropped into a DOS shell), I was able to use the "fixmbr" utility to rewrite the MBR, bypassing GRUB entirely. I rebooted into XP and again tried using Partition Magic to delete the ext3 Linux partition, but it still gave me the #510 error. It was then necessary to drop into the Recovery Console again and use the "diskpart" tool to delete the Linux partition. At that point I was able to boot back into XP, and use Partition Manager to redistribute my free space and then merge my main and file storage partitions. It sounds somewhat arduous but definitely was much less troublesome than I was expecting.

Here's a step-by-step rundown:

1. Try MBRFIX first -- if it works for you, great!
2. Try the XP Recovery Console (again, you cannot use an unattended install disc!). Hit R to open the Recovery Console after booting from CD, use the 'fixmbr' tool to remove the GRUB bootloader, then use the 'diskpart' tool to delete any ext3 partitions you might have (everything is well labeled, so you shouldn't have to worry about which partition is which).
3. Use Partition Magic or a similar tool to merge any remaining partitions or free space into a single drive. I found that Partition Magic did not merge the portion of the drive with files on it, so you may want to move your files to the primary partition first, then delete any secondary partitions and merge the resulting free space with your primary part.

I was really surprised at how well this all worked -- I kept suspecting that everything would fail and I would have to do a clean reinstall (and it's important to mention that I was prepared to do so -- I wouldn't try this without a solid backup) , but everything worked pretty much the way it should have and I was able to get away without reinstalling XP.