On partitions, boot loaders, and multi-boot woes
Posted on: 13 May 2008
I have a rather old laptop which is set up to dual boot between Windows XP and Linux (Red Hat 9) using GRUB. Unfortunately this machine now needs to be fully dedicated to Windows (it only has a 10GB disk, and we have 8GB of data to be cleansed using a Windows app), so I've had to remove Linux. This proved slightly trickier than I suspected, mainly because of my own rashness.
The laptop was configured with four partitions:
1. the main Windows partition (XP was installed before Red Hat)
2. a Linux boot partition
3. a Linux OS partition
4. a Linux swap partition
So far, so standard.
However, my cunning plan to remove Red Hat was simply to delete the 3 Linux partitions, and extend the Windows partition to the full extent of the disk. I duly deleted the Linux partitions using the Windows Disk Manager.
Hitch number 1 was that the XP diskpart utility can only extend NTFS partitions, and my XP partition was FAT32 (due to concerns at the time about Red Hat writing data to NTFS partitions). Still, it's pretty simple to convert FAT32 to NTFS, so I made the changes, and sat back for the laptop to reboot.
Have you spotted the schoolboy error yet?
I spotted it around about the time a very bare-looking GRUB shell came up. Once I realised I had deleted the boot partition, I was actually quite relieved to get any kind of shell at all. At least recovery should be possible.
A bit of digging around found some useful advice on booting XP from the GRUB shell, which at least got me back into Windows. I then just had to restore the old XP boot loader, which turned out to be as simple as booting into the recovery console from an XP install CD (although finding an XP CD wasn't quite so simple!), and running "fixmbr".
Once I'd got the MBR straightened out and was booting into XP OK, I could finally run the XP diskpart utility and extend my shiny new NTFS partition into all that lovely empty space on the disk.
Another classic example of Hofstadter's Law.