Hyper-V VHD Expansion Failure

•June 14, 2009 • Leave a Comment

I have just had the most random issue with Hyper-v, I was tasked with expanding a fixed VHD (Virtual Hard Disk) file so the client would have more drive space.

A pretty simple task to complete but if something goes wrong then can cause some major disruptions to the network.

After backing up the orginal VHD to a external USB drive. I then proceeded to expand the vhd file, this process took about a hour to expand a 115GB file out to a 145GB file.

After the expansion I then booted up the system and everything worked perfectly yay simple job completed.

I then shutdown the server as I had some other work to complete on the host that required a reboot, after rebooting the host I then tried to start the virtual machine this time it got to 50% then failed to boot – awesome just what I needed!! After some checking I found that the expanded VHD had failed and was unreadable the – Great Success!

I now had a 145GB file that was corrupted and no way of recovery because my attached USB drive was not detecting anymore great now I had no return point! Also this was a remote site so no way to rectify the failed usb drive.

After sometime researching and looking for possible solutions I finally found one, it was a bit extreme but was worth a shot.

First off find I had to find a enough storage for a copy of the vhd that was easy and used a couple of the computers on the local network.

From within Hyper-v manager I had to go to the virtual disk that has failed and select edit.
Then select the option to convert the drive to dynamic, this is the extreme part.
Select a location for the dynamic vhd file, then click on finish.
Depending on the speed of the network and the size of the vhd this can take some time in my case took about 3 hours.
Your next step is to recopy the file back to your Hyper-V server, you can ether keep the failed VHD or backup the file I choose to backup the file.

You are almost ready to bring the system back online, the recommended process is to delete the old failed disks from the virtual machine settings then re add the new drive this ensures that all the correct permissions are applied to the new dynamic drive. I had some permission problems when I just selected the drive.

Then boot your system and you should be backup and running woohoo!

Now you can ether leave the drive as dynamic or convert it back to fixed however again you need to ensure you have enough space for the VHD file etc.

The system is now backup and running and the client should be happy on Monday, the interesting factor was I expanded anther three VHD disks after this one failed without any problems.

Thats why I started out a career in IT :)

If at first you don’t succeed, then you fail!

•June 14, 2009 • Leave a Comment

Welcome I have finally decided that if you can’t take the piss out of fellow geeks then your better off joining them. So here we go on the rocky ride of a systems engineer in Wild!