A Hyper-V snapshot is an encapsulation of a running VM’s state, data, and hardware configuration. When the user creates a snapshot, it creates a point in time for that VM and allows an easy way to revert a system to a previous state should a problem arise. For example, you might want to take a snapshot of the VM before installing a new software package so that you can revert to the snapshot. After reverting, you will be running the system at the point before the new software was installed. You can create a snapshots using the Hyper-V manager by right clicking on the name of the VM and selecting “Snapshot” from the context menu. In this example, the virtual machine “winxp-73” has 3 snapshots, take at 8:30 am, 9:42 am, and 9:43 am on 9/18:

As described in earlier blog posts, Hyper-V VMs are stored in .vhd(x) files. Similarly, snapshot data files are .avhd(x) files on the file system, typically in the same directory as the .vhd (In earlier Windows releases they are located in the same directory as the VM configuration files). If you create multiple snapshots or keep around older snapshots, these .avhd(x) files can consume a lot of space on the file system to the point that you run out of space and all of your VMs quit running. The reason for this is that each .avhd(x) file tracks changes, so all data changed from the point in time at which they were created must be tracked in the .avhd(x) file.

To remove snapshots use the Hyper-V snapshot manager; never delete the .avhd(x) files by hand. You can revert to the point in time of the most recent snapshot by selecting the VM from the virtual machines list, right clicking and selecting “Revert”. At that point you’ll see a message to confirm that you want to go back to the creation of this snapshot (for VM winxp-73, it reverts to the date of the last snapshot at 9:43:44 am on 9/18):

If you select “Revert” the system will be restarted at the point of the previous snapshot. To delete a snapshot, using the Hyper-V Manager, select a VM and go to the “Snapshots” window and select a snapshot to delete. Then right click to select or select “Delete Snapshot…” from the right hand portion of the Hyper-V Manager where the details of the VM are displayed. Again you will see a confirmation dialog, in this case to delete the snapshot you selected:

If you select “Delete” the snapshot will be removed. For example, we deleted the oldest snapshot for winxp-73 from 8:30 am, so only two snapshots remain:

You can delete all snapshots from the selected and subsequent snapshots in the chain by selecting “Delete Snapshot Subtree…”. Like the previous deletion, you will see a confirmation message for deletion of the entire set of snapshots, and if you select “Delete” the selected snapshot and those that follow will be removed. For win-73, I selected the oldest snapshot and deleted the sub-tree, and afterwards there were no snapshots for winxp-73:

The longer a snapshot is kept around, the larger the .avhd(x) files will continue to grow. Removing a snapshot means that data from the .avhd(x) gets merged back into the virtual machine disks (.vhd(x) files), and you will see the status of a VM indicating that a merge is in progress. Older snapshots will take longer to merge. For example, after deleting an old snapshot for Win2012-Agent-246, you can see that the snapshot merge is in progress:

  The VM continues to run while the snapshot merge is taking place.

If you look in the file system for the .avhd(x) file that represents this snapshot, you will see that it is not deleted until the merge of data to the .vhd(x) is completed.

As described in previous blogs, you can use the Unitrends product to protect your Hyper-V VMs Once a Hyper-V server is registered to the system, you will see the list of VMs in the navigational tree. If you select a VM and start a backup, it uses Microsoft VSS snapshot technology to programmatically create a VSS snapshot and then transmit the backup data to the appliance.

From the Unitrends UI, we can see the progression of the backup in the Jobs listing:


Note that this type of snapshot is not generated by the user so does not show up in the Hyper-V Manager. However, you can see that a backup of the VM is in progress from the Hyper-V manager. As with Hyper-V snapshots the VM continues to run while being backed up.

VSS Snapshots are disk only, and do not include in-memory state, and are intended for backup. Unlike a Hyper-V snapshot, there can be only one VSS snapshot of a VM at a time. VSS manages its snapshots closely so as not to allow an aging snapshot to consume too much disk space, but Hyper-V snapshots can easily cause problems as they age.

About Unitrends

Unitrends increases uptime, productivity and confidence in a world in which IT professionals must do more with less. Unitrends leverages high-availability hardware and software engineering, cloud economics, enterprise power with consumer-grade design, and customer-obsessed support to natively provide all-in-one enterprise backup and continuity. The result is a “one throat to choke” set of offerings that allow customers to focus on their business rather than backup.