Hyper-V Live Merge Snapshot Feature in Windows Server 2012

One of the best new features I’ve noticed while testing Hyper-V on the release candidate of Windows Server 2012 is the ability to merge snapshots while a virtual machine is running without the need for a restart as was required by Hyper-V in Windows Server 2008 R2.

The Windows 7 VM shown below is currently running and it has one snapshot:

When a snapshot is created a .avhdx file is created and any changes from that point forward are written to it instead of the .vhdx file:

Here are the files shown on the file system. These (.vhdx and .avhdx) are new file types in Windows Server 2012. They are .vhd and .avhd in Windows Server 2008 R2.

I’ve selected the snapshot for this VM and I’m deleting it:

After deleting a snapshot in Hyper-V on Windows 2008 R2, the changes in the .avhd wouldn’t be merged  into the .vhd until the VM was shutdown, but with Windows Server 2012, the changes in the .avhdx file are merged into the .vhdx file on the fly:

As you can see, the Windows 7 VM no longer has any snapshots:

The virtual hard drive for this VM now references the .vhdx file:



  1. niko

    Mike, I have two .avhdx files, but no snapshot was taken. There files are consuming a lot of disk space, how can I force Hyper-V to merge them into the vhdx?

  2. BizTalkers (@BizTalkers)

    Hi Mike, very clear and helpful – thanks!

  3. singh

    Hi Mike, great information. I ran into a problem. I am hoping you could guide me in the right direction. I have a lab environment running hyperv 2012 nodes. One of the hyperv 2012 node with das crashed and couple of the vms on it are in critical state. It is a lab environment so its not causing any major disruption, but one the vm was a web server which has a sql db that i need to retrieve.

    What happened is I tried to reattach the vms vhdx file to a a new machine and somehow an older snapshot got merged with the most recent vhdx. I was able to stat the vm but it has older data from the snapshot, which is not helpful.

    Is there anyway or tool to retrieve the files from the original vhdx,
    Files and folders: wwwroot folder and sql db.

    Please let me know, I would really appreciate you help.


  4. Swift

    I stumbeled on another method could also be used. This method requires you to have Hyper-V replication configured and up-and-running. Configuring Replication and getting it to work can be quite tricky at first. But, if you already have a working Hyper-V Replication environment then it’s pretty straight forward.
    It works like this:

    1. Ensure there is sufficient storage space available on the Volume where the affected VHD\VHDX and AVHD\AVHDX files reside. (+/-13% (that’s just over 250GB) on a 2TB Volume. This was enough for me. It depends on the Size of the VHD\VHDX and AVHD\AVHDX files though. (1.75TB was used up by my buggy VM’s VHD\VHDX and AVHD\AVHDX files combined, which is massive when considering that the VHDX files where only allocated about 500GB combined. It just goes to show how serious the matter can get, and I wasn’t even using thin provisioning)).
    2. If the VM in question has replication enabled (which is most likely in a failed state by now), disable and remove it from the VM. Also make sure replication is disabled and removed on the Replica VM (replica destination). Then remove the Replica VM and the Replica VHD\VHDX files from the Replica Destination for the affected VM all together so that no trace of the Replica exists on the Replication destination.
    3. Now, setup brand new Replication for the affected VM. Go through the whole process and allow Replication to start immediately. Once replication starts, give it some time until it reaches about 2% then Cancel the replication process.
    4. Once replication has stopped Hyper-V will automatically attempt a merge of all AVHDX files that belong to that VM,.
    5. If you have lots of sizable AVHDX files, this merge can take a long time. Allow it to complete, even if it runs for a day or so. You should also notice your free space increase after each AVHDX file that is merged with its parent.
    6. If all goes well you should only be left with the VHD\VHDX files; and plenty of free space if your situation is similar than mine.
    7. If needed, remember to re-instate Replication once the merge is complete.
    8. Keep an eye out on that VM for a few days to ensure it does not start with its tricks again.
    Hope this method can help someone in a dire situation.
    Note, in my case this was a production critical VM that went into “paused” mode. Once I managed to make enough free space (by moving other VMs off from that Storage Volume), I could save and start the VM; and do the above process while the VM was running. (This was on Hyper-V 2012 R2)!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: