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?

  • 2
    Note for future people: When deleting snapshots the machine has to be turned off for the Hard Drive Files to be merged. If you never do this step, you end up with vhd and avhd files... This is the root of the problem here. – Chris S Dec 30 '12 at 1:33

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?

  • This is one of the articles we've tried. We've tried it several different ways. Doing it exactly as described yields "The server encountered an error trying to edit the virtual disk. Reconnecting the virtual disk 'foo.avhd' to its parent disk 'foo.vhd' failed. The operation was passed an invalid parameter." We've tried it with copies (as described). We've tried it with the originals. We've tried it with copies on another host. They all yield the same result. – Kevin Donn Jul 12 '11 at 20:13
  • You're supposed to rename the avhd to a vhd extension. If you've already done that....well...what's your backup look like? – Jason Berg Jul 12 '11 at 21:33
  • Sorry. In the message above I chopped out the actual path to the avhd file, but I did indeed change it to vhd. I have internal backups for the machine; it's just a lot more work to go that route. So "The operation was passed an invalid parameter." means what? The disk images are corrupted? What? I don't get it. The host never crashed or anything, the virtual ran fine until deleted. It's just unrecoverable now? – Kevin Donn Jul 13 '11 at 18:45
  • @Jason Berg Did you mean to say, "Browse to the OLDEST VHD in the chain"... as opposed to the youngest? The youngest is not a differencing disk and therefore will not give you the option to "reconnect". – Brain2000 Jan 27 '15 at 20:26

As far as I can tell, if you get the error, one snapshot file is missing.

So if you have vhd + avhd (first snapshot) + avhd (second snapshot) and only have the file of the second snapshot and the vhd, you get the error.

We also discovered that error:

Had one virtual machine with one snapshot. We shutdown the machine and deleted the snapshot - but no merge started. So we tried it manually (vhd + 1 avhd file), but got the error you are describing.

The restored virtual machine backup showed, that there were actually two 2 avhd files. So something (Hyper-V ?) messed up with deleting the snapshot and not showing the second one in the GUI. So deleting the snapshot ended in vhd file + avhd from snapshot but missing the second avhd file from a (former) deleted snapshot, which did not show up in the GUI.

It is really strange and we never discovered that before.

  • 1
    After snapshots are deleted you must turn the VM off for the vhd files to be merged. If you had read the Hyper-V documentation you would know this. – Chris S Dec 30 '12 at 1:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.