Hyper-V 2008 R2 Virtual Machine Snapshots: FAQ
Note: This article is based on Hyper-V 2.0, and might not apply to Hyper-V 3.0 (Server 2012)
This article is sourced from the TechNet library Hyper-V Snapshot FAQ, and is been reproduced to encourage the community to correct any inaccuracies and provide other enhancements prior to including updates in the official version of this topic.
What are virtual machine snapshots?
Virtual machine snapshots capture the state, data, and hardware configuration of a virtual machine.
What are snapshots used for?
Snapshots provide a fast and easy way to revert the virtual machine to a previous state. For this reason, virtual machine snapshots are intended mainly for use in development and test environments. Having an easy way to revert a virtual machine can be very useful if you need to recreate a specific state or condition so that you can troubleshoot a problem.
There are certain circumstances in which it may make sense to use snapshots in a production environment. For example, you can use snapshots to provide a way to revert a potentially risky operation in a production environment, such as applying an update to the software running in the virtual machine.
How are snapshots stored?
Changes for virtual machine disks are stored as Automatic Virtual Hard Disk (.avhd) files. In Windows Server 2008 R2, .avhd files are always created in the same location as their parent Virtual Hard Disk (.vhd) files by default. If the VM was imported with snapshots, they are stored in their own folder. If the virtual machine has no snapshots and you configure the virtual machine snapshot setting, the snapshots will be stored in the folder you specify. Taking multiple snapshots can quickly consume storage space. For more information on where VM files are stored see Hyper-V: How to Find VM Files.
Can I delete these pesky .avhd files?
Do not delete .avhd files directly from the storage location. Instead, use Hyper-V Manager to select the virtual machine, and then delete the entire snapshot from the snapshot tree. Review the common snapshot issues video so you can avoid common mistakes in managing snapshots, .avhd files, and disk space.
What other important considerations I should be aware of when using snapshots?
Keep the following considerations in mind, especially if you plan to use snapshots on a virtual machine in a production environment:
The presence of a virtual machine snapshot reduces the disk performance of the virtual machine.
When you delete a snapshot, the .avhd files that store the snapshot data remain in the storage location until the virtual machine is shut down, turned off, or put into a saved state. As a result, when you delete a snapshot, you will need to put the production virtual machine into one of those states at some point to be able to complete the safe removal of the snapshot.
We do not recommend using snapshots on virtual machines that provide time-sensitive services, or when performance or the availability of storage space is critical.
Note
Microsoft does not support the use of snapshots on virtual machines hosting the Active Directory Domain Services role (also known as “domain controllers”) or virtual machines hosting the Active Directory Lightweight Directory Services role. For more information, see Operational Considerations for Virtualized Domain Controllers and [[articles:Choice of Virtualization Strategy: Backup and Restore|Choice of Virtualization Strategy: Backup and Restore]].
I’ve taken multiple snapshots and now my virtual machine pauses automatically. Hyper-V Manager shows the status as ‘paused-critical’. How can I fix this?
This problem occurs when you have run out of space on the physical storage where the virtual machine snapshot files are stored. Note that this may be on a different drive than where the virtual hard disk is stored.
To fix the problem, create additional space on the drive by deleting unused data. For example, if you do not need to keep some of the snapshots, you can delete the snapshots individually. (Make sure to use Hyper-V Manager to delete the snapshots. Do not delete the .ahvd files directly). Or, to delete all of the snapshots in one action, export the virtual machine and then import the virtual machine. If you delete snapshots, you must shut down, turn off, or save the state of the virtual machine to delete the snapshots from the physical storage.
I’ve deleted some snapshots to free up storage space, but the space hasn’t been recovered. What can I do?
Shut down the virtual machine—or, if that action is not available, turn off the virtual machine. Deleted virtual machine files are not removed from the physical storage until the virtual machine is shut down, turned off, or put into a saved state. Depending on the size and number of snapshots, it may take awhile to delete the snapshot files. Hyper-V Manager displays the progress when deleting the snapshots. For a detailed explanation see http://blogs.msdn.com/b/virtual_pc_guy/archive/2009/04/20/why-does-it-take-so-long-to-delete-a-virtual-machine-with-snapshots-hyper-v.aspx
Should snapshots be used as a substitute for backups?
No, because virtual machine snapshots are not the same as backups created by a Volume Shadow Copy Service (VSS) writer. We do not recommend using virtual machine snapshots as a permanent data or system recovery solution. Even though virtual machine snapshots provide a convenient way to store different points of system state, data, and configuration, there are some inherent risks of unintended data loss if they are not managed appropriately. A backup solution helps provide protection that is not provided by snapshots.
One reason that snapshots are not an acceptable substitute for a backup is that they do not protect against problems that may occur on the server running Hyper-V, such as a hardware malfunction on the physical computer or a software-related issue in the management operating system. Another reason is that applications that run in a virtual machine are not aware of the snapshot, and will not be able to adjust appropriately. For example, if you used a virtual machine snapshot to restore an Exchange server, the server would expect the same set of client connections that were present when the snapshot was taken.
For more information about backing up Hyper-V and its virtual machines, see Planning for Backup and [[articles:Choice of Virtualization Strategy: Backup and Restore|Choice of Virtualization Strategy: Backup and Restore]].