Recovering a Hyper-V vhd from a snapshot

disaster-recoveryhyper-vsnapshot

I'm going to leave out tons of related info that I hope isn't relevant to keep this lean – feel free to ask for detail.

My host is a Windows Server 2008 Standard SP2 (not R2). Last February we had created a snapshot on a virtual machine and then deleted it. About a month later we created another snapshot and deleted it as well. In the Hyper-V manager the virtual machine was not showing any Snapshots. We then deleted the Virtual Machine in preparation to move it to another host (not a good plan, but there you go).

After moving the vhd, we realized the machine was oddly out of date so we went back to the original host and discovered that the vhd had the February date from the first snapshot. We then found that a snapshot had evidently still been in play (although we're pretty sure it didn't show up in Hyper-V Manager).

So now we have the Feb vhd file and the current avhd file, but can't figure out how to get this virtual machine back up and running anywhere. We've found some articles that give approaches, but none of them seem to fit our circumstances and we've run into roadblocks with all of them.

So is there a correct path to recovery here?

Best Answer

There is a way to manually merge the snapshots. Here's the process in a nutshell:

  1. Make a copy of the VHD and its corresponding AVHD files.
  2. Rename the AVHD extension to VHD.
  3. Write down the order of the disks from youngest to oldest (the oldest should be the root VHD). You can do this by looking at the last modified time stamp on the origional AVHD files, find the one that last changed. And find the last one that changed before it.
  4. In the Hyper-V manager, open the Edit Disk wizard. Browse to the youngest VHD in the chain, then choose 'reconnect' to point to the next youngest (the one that came before).
  5. Open the Edit Disk wizard a second time and merge.
  6. Then repeat the process until you have only a single VHD.

See the source article here for more information.

In the future, you should move VMs around by exporting them and importing them. It's a lot safer to do. Microsoft has a nice blog about it here

Also, this is a great time to evaluate your backup methods. Hopefully you didn't lose anything this time, but what about next time?