Thursday, August 07, 2008

Recovering from Computer Stupidity with GParted

The other day I did something really stupid: I trusted Microsoft.

The youngest son asked me if I could help him change which was the boot drive on his fancy gaming box (I won't get into the ugly particulars of this project). He's pretty smart, but I'm the Alpha Geek in the house.

My mistake: I didn't do my research before sitting down at the keyboard. While at the XP Recovery Console, I ran a command called "FIXBOOT."

It sounded like what I wanted to do, and indeed subsequent cursory research suggested that was the right command. But when I rebooted (without the old C: drive) I got "NTLDR is missing. Press CTR+ALT+DEL to restart."

The hair on the back of my neck now being to rise, I told Youngest Son to put the old C: drive back in and then reboot. Several attempts later, I get into Safe Mode and try and look at the drive I'd been working on.

Bad Mojo -- screwy filenames, missing stuff, wrong size partition. Oh my. By now I've figured out that I've made a very bad mistake.

After a good night's sleep I realize the problem was that the partition table was messed up. Research told me in all likelihood, FIXBOOT tried to make the NTFS partition into a FAT16 partition. Not a good thing, but hopefully something I could recover from *if* I could change the partition type back to NTFS.

My initial search for repair tools brought up a couple of shareware programs that would analyse the problem but not fix the problem (unless you bought the program). While the cost was not outrageous, I decided to look for open source alternatives.

After a bit of Googling, I found GParted (Gnome Partition Editor), a Linux-based bootable CD.

I downloaded a CD ISO image, burned it to disk, and fired it up.

The disk booted into a graphical Linux environment, with a clean minimal interface. Not exactly for the faint of heart, but very usable. GParted loaded and scanned for partititions. When it pulled up the misbehaving drive, it showed it was clearly messed up, and confirmed my suspicions: the partition type was showing as FAT16. What the hell?

Unfortunately GParted does not allow you to change the partition type. I ran another tool, TestDisk, which analyzed the disk and revealed in the blink of an eye that it was a NTFS partition. What's more, it showed the correct partition size, something that GParted did not, when the partition type was FAT16.

The final step was to write the new partition information to the disk, which I did while saying a tiny prayer. I hit reboot and held my breath.

Hey Presto! XP is back (oh joy).

GParted, though Linux-based, will allow you to work on Linux and Windows partitions. The documentation also shows support for Mac OS - based partitions (HFS and HFS+), though this would require the drive to be on an Intel-based platform.

With it you can create, grow, shrink, move, clone and check your partitions. Included on the bootable CD are several other utilities, chief among them TestDisk, a powerful partition repair tool. It will fix partition tables, recover deleted partitions, rebuild boot sectors, and other recovery operations. This is the one that saved my chops.

As with other powerful tools, it can be dangerous if you don't know what you're doing. A chain saw can remove arms as well as tree limbs. Still, if you find yourself in desparate straits, it can be a real life-saver.

As with most things, your mileage may vary.

No comments: