I've previously whined incessantly about how Windows could not recognize my USB keyboard. Well, I tried to fix it today and Windows fried my system entirely.
Essentially I was sick enough of how broken XP was that I decided to put it to death and reinstall it from scratch. So I backed everything up that I cared about from Windows (i.e. very little) to a folder in Linux and then I
mkfs.vfat the partition, cackling with glee all the while. Then I needed only to reboot from the XP install CD and install XP on the nice, shiny, pre-formatted, blank partition that is just waiting to be defiled with its presence. How simple! For those of you who have tried this before, you may be experiencing some "dramatic irony" at this point, because you know of the disaster soon to come.
After booting from the XP install CD and being witness to the 1980's blue DOS install screen, and pounding F8 to indicate that I indeed sacrifice my immortal soul via the EULA, I got to a screen where Windows offered a choice of partitions to install to. However the 35GB FAT32 partition I had created was nowhere to be found. What WAS to be found was a 131GB "Unknown" partition. This is very curious, because I don't HAVE a 131GB partition on my system at all. I have a 35GB FAT32, a 200GB ext3, a 45GB et3 for root and a tiny boot and swap partition. The drive itself is 300GB total. Where this 131GB value came from, I will never know.
I rebooted about 18 times, consulting Google in Linux and then trying the XP install CD again, and again, and again, to no avail. The very last time, I thought hey, let me just select this "Unknown" partition and see what it says. So I hit Enter. XP at this point asked if I'd like to format the partition to NTFS the quick way, or the slow way. I said "No thank you" and exited the installer.
Lo and behold, my system was no longer bootable. Why? I started rebooting from my large, out-of-date collection of liveCDs until I found one that worked.
fdisk /dev/sda showed that I now had a 131GB unformatted partition and nothing else. Bye bye Linux! Apparently as soon as you hit Enter on the install CD as above, Windows automatically overwrites your partition table without asking.
At this point let us say I "lost my cool". There was an incident involving a broom being wielded in blind rage at all inanimate objects that dared to cross my path. My cat wisely fled my wrath.
I do have backups of everything of real importance. But I'd downloaded a LOT of stuff in the past two weeks that would be lost. And I have a bunch of stuff that while not life-threatening to lose, would take an awful lot of time and effort to get back.
But all that was destroyed was my partition table, I eventually reasoned. After googling for "restore partition table" I found that gpart should in theory be able to save me. But how to actually run it on my system which could not boot? The website recommends using a floppy (I have no floppy drive) or putting the crippled HD into another computer. My spare computer however cannot use SATA hard drives.
So I did what any reasonable person would do at this point: I went to my spare computer and tore out its hard drive (containing Debian) and stuffed it into my now-defunct computer and booted from it. Oh how badly this choked. After stalling for 5 minutes complaining of interrupts timing-out, I got a kernel panic, something to the effect of "Kernel tried to kill INIT!"
I realized at this point that I did not even HAVE a Ubuntu liveCD to reinstall from even if I wanted to. As a last resort I booted from my GENTOO install CD (2006.0). I prayed that it would contain gpart. It did not. I felt the last of my will to live slowly drain away. But lo! It turns out there's a statically linked binary of gpart on the gpart website. I downloaded it and against all odds, it actually worked.
My tale does not end here. Upon rebooting, I got a "NO OPERATING SYSTEM FOUND ON DISK" from my BIOS. Whoops! Looks like the XP installer ate grub for breakfast too! Again, how to restore grub given that I have no Ubuntu liveCD? Well, Gentoo to the rescue again. Sadly, the Gentoo CD does not contain grub. But after a few minutes of ape-like head-scratching I realized that I only had to chroot into my Ubuntu install and do it that way. I actually consulted the Gentoo install manual to remember the syntax of mounting /proc and /dev correctly. A short grub-install later and, as angels sang and trumpets sounded, I'm back in Ubuntu.
The morals of this sad tale:
- Windows is a piece of long string of expletives deleted.
- Never ever try to install Windows AFTER you install Linux. Down this path lies MADNESS.
- If I hadn't had the experience of setting up my system the Gentoo way I'd have been utterly screwed.
- Keep up-to-date LiveCDs at all times.
- Make HD backups MORE OFTEN.