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:

µ

3 Comments

  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?

    Reply
  2. BizTalkers (@BizTalkers)

    Hi Mike, very clear and helpful – thanks!

    Reply
  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.

    Thanks
    Rsingh

    Reply

Leave a Reply

%d bloggers like this: