Oh Microsoft..

Came across an interesting problem today. I resized a VMDK of a Windows Server 2008 R2 virtual machine today, then ran gparted, and when I rebooted.. it was no good.

In Windows’ defence, I made some mistakes. I told gparted to align to cylinder boundaries, which the original partition wasn’t, and I didn’t let the VM shut down properly (it had rebooted, so I figure it would be ok to do a virtual power down.. oops). I also didn’t take a vmware snapshot beforehand.

But being the nice person I am and not wanting to waste one of my co-worker’s days work on it by reverting to backups, I thought I’d give it a bit of a go at fixing it.

First step was manually un-aligning it back to the geometry I had before, which I did using the command line parted in “sector” unit mode. Then I tried booting.. and no luck.

I did some reading, and had got to reading about bcdedit, the new tool in vista/2008 for editing boot parameters. It’s pretty hardcore.. I tried resetting it, and got slightly different errors, but it still didn’t work.

I did some more googling on the error, and found someone describing how to fix the same problem with Vista. You just pop in the system install disk and follow some prompts, and it’ll automatically repair it. Cool! I thought, I’ll just put in the Win2008R2 DVD image, and it’ll do the same thing.

No dice.

Then I thought.. I wonder what will happen if I boot it from a Vista install DVD, they’re close enough? And blow me down, it worked. So there we go – the solution to a Windows 2008 R2 problem was to use the Windows Vista desktop install DVD.

Only thing left to do was let it shut down gracefully, then run ntfsresize, and it all seems to be working.