Sunday, April 29, 2007

The HORROR, part I (or how not to upgrade your windows hard drive)

Every year or so I forget just how awful Microsoft's Windows XP operating system can be if it starts going wrong. Its fine when it works, but diagnosing any problem turns into hours of web searching and installing round after round of obscure utilities, with almost none of them actually created by the damn company that actually created the operating system. By comparison Linux administration and system repair is trivially easy. But sooner or later something happens and I end up spending multiple nights and/or weekends slaving away with only a growing sick feeling of frustration to keep me company.

You might think that replacing your primary drive with a new one containing the original data would be easy - in fact it is trivial with Linux alone, but if you're dealing with windows as well, its not. I'll discuss how to do this (The Horror, part II) when I've solved the basic problem I have which is that the new drive doesn't have what Windows thinks is a valid Master Boot Record despite it working fine for Linux (I suspect the real problem is that the FAT32 partitions were created by Linux, and although they're technically true FAT32, Windows is deliberately refusing to acknowledge them as it can see an XP installer didn't make them).

But in the mean time a piece of MS crapware totally mangled the partition table for my third disk drive that contained non-backed-up a FAT32 partition (with a variety of important documents and my music collections), my Linux /home partition and my local /data1 drive. So now I had an even bigger problem than my original upgrade problem.

How could this happen? Well, for reasons that will become apparent in The Horror part II, I ended up trying to use a Windows 98 boot floppy to repartition the new drive and create the FAT32 partitions I planned to reinstall Windows to (the XP Recovery disk I'm using would only allow me to create NTFS partitions for some annoying reason). Both the XP CD and the W98 floppy were listing my drives in an odd, non-BIOS, order and with odd letters (e.g. the first drive they claimed to be D:), but as the drives are all different sizes I tried to select the correct drive to repartition using MS's FDISK based on its size. However, all of them were reported with incorrect sizes, presumably because Windows 98 simply can't conceive of a drive larger than ~130 GB or so.

I thought I had selected the new drive to repartition and proceeded with FDISK, but eventually gave up without writing the partition table because FDISK kept reducing its estimation of the drive size any time I did anything with it. Today I discovered that in fact it had written some garbage FAT16 partition onto a totally different drive, erasing two Linux partitions and my largest FAT32 partition. None of them backed-up, by some monumental oversight of mine.

Windows now saw the drive as needing formatting, and I had to use a rescue CD just to get into FC6.

Frantic searching on the web found DiskInternals free Windows program called DiskInternals Linux Recovery. This found some of the directories on one of the Linux partitions (the /home partition, which happened to be /dev/hdc1 before the partition wipe), but not my /data partition. Nor did it find the important files on the missing FAT32 partition. The software claimed to be able to repair damaged or corrupted partition tables, but in fact did not seem to have this facility. Instead, DiskInternals has another utility (free demo, $140 for full version) called DiskInternals Partition Recovery. The free demo found the FAT32 partition, and could even very slowly get a few files off it, but this still was not a solution.

Eventually I found another Windows program called Partition Table Doctor 3.5 (free demo, $40 full version). This time the free demo found the ext3 and fat32 partitions quickly as well as determining whether they were primary or extended (the fat32 partition was a logical partition in an extended partition, for example), and I could even verify the names of the base directories in the fat partition. The trial demo won't write the partition though. I tried using the cylinder/head etc data given by the trial version with fdisk under Linux to rewrite the partition table, but this resulted in un-mountable (i.e bad) partitions.

Feeling tired and defeated I bought the bullet and purchased the full version of Partition Doctor online, which I then downloaded and ran. Despite my messing with the partition table in Linux it still found the original partitioning scheme and after hitting save I rebooted into FC6 to find it had actually worked. The FAT32 drive turned up fine in Windows too.

So I'm back to were I was a few days ago, still unable to boot Windows off the new drive, still running Windows from the aged and soon-to-fail drive, and $40 poorer, all thanks to Microsoft.

If there were a decent selection of games for OS X (and if Apple's desktop hardware wasn't so horribly over-priced), I'd switch to OS X for my home system in an instant.

Post a Comment