Chryzo's Notepad

June 6, 2009

Hyper-V, corrupt virtual machine ?

Filed under: Hyper-V,Windows — Tags: , , — Chryzo @ 11:46

A while back, i had a proof of concept on a hyper-v virtual machine. Said machine, one day, crashed (hypothesys being that the antivirus scanned or tried to write some place not possible due to physical disk limitations). On reboot the machine would not start and the admin told me it was corrupted or something and i had lost the data of the machine.
Since the application was a POC, i did not really care but my boss was still intent on getting the data back…
So i started to take a look into how I could get the data back. So, I downloaded WinImage to read VHD files. Though I could open my file, all my data was absent :( . Searching a bit more I got an AVHD file but could not open it with WinImage. Thus I found that Hyper-V disk files are split into 2:

  • VHD: contains the image before boot of the VM
  • AVHD: contains the modifications of the VM, you may have more than one

Those files are not merged until you actually shutdown the VM… pretty annoying. To merge the files, it is pretty easy. You do not need a Hyper-V server, I was fortunate since my admin was stubborn enough to keep telling me I could not get the data back. You can simply use Virtual PC 2007 and the disk wizard utility.
Once the files were merged I was able to get the data back without any corruption whatsoevre.
And, since the VM config file was corupt, I asked the admin to reload the merged disk into a new server. Only problem is that the new server was not seen as the old one and I got into some authentification poblems with the application on the domain.

So, to end this post, if you have corrupt files, first merge the VHD and AVHD files. Check if you can open them through windows 7, server 2008 or WinImage. As for the server not rejoining the domain, I ll let some AD expert answer if it is possible or not. I think so, but I may be Wrong.

And as a last note, before increasing the size of a disk in Hyper-V, you need to merge the VHD and AVHD files!

In the hope this may help other people

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress