Thursday, May 17, 2012

Thanks, Windows. Thindows.

So the main drive in my wintendo decided to puke on me. I managed to catch it pretty quickly, so data recovery thankfully wasn't much of an issue.

I ordered up a new drive (twice the size, no less) on newegg and it arrived this afternoon. I popped the drive in and booted up the existing linux install, using ntfsclone to copy the windows data from old to new, and xfsdump/xfsrestore for the linux side of things.

A few blocks on the windows side didn't copy, so hopefully they weren't anything critical.

Next up was fixing the booting. Unlike MacOS X, PC operating systems can't find their own ass with both hands and a GPS.

On linux, updating things is relatively straightforward: install grub, mess around with the config a bit, rebuild the initrd, fix the fstab and you're good to go. A few manual steps, but sensible ones all the same.

On windows... Well, we try to boot windows and all we get is a black screen of ambiguity. This is as unfortunate as it is unhelpful. A little googling reveals these instructions for helping windows unfuck itself. Now, I know you're not all as tech-minded as I am, so I'll try to break things down fairly simply:

Basically, if the position of the windows partition on the disk changes at all, Windows won't be able to find the partition to boot from it. Even though the partition's new location is clearly listed in the partition table.

To solve this issue, you must hex edit the partition and tell windows where it starts. Think about this carefully a moment: you have to tell windows where the start of the partition is, and this information is recorded a fixed number of bytes away from... the start of the partition.

Sweet mother of christmas, if I were a windows OS programmer I would have had to seppuku myself 12 times over to try to erase the shame of my own blinding stupidity.