Home  Tutorials  Generality

Disadvantages in Hyper-V Snapshotting (EN)

Hyper-V supports taking and restoring snapshots for virtual machines. Using snapshots is an easy way to get a virtual machine to a previous state but this is not a good approach to follow in production environments.

This Wiki article was written after we have noticed that TechNet Forum users reported many times failures in systems they manage after using Hyper-V snapshots (Example: USN Rollback for Domain Controllers). It actually describes the disadvantages of using Hyper-V snapshots and provide a better understanding of when an administrator could or should not use snapshots.

What happens when a Hyper-V administrator takes a snapshot for a virtual machine?

Let’s suppose that we have virtual machine running on Hyper-V with no existing snapshots. The virtual machine has two virtual VHDX disks: The first disk is for system drive and the other one is for data drive.

Figure 1. Pre-snapshot representation of disk files for the virtual machine

Here, the virtual machine will do:
  • Read operations from the two (2) .VHDX files
  • Write operations on the two (2) .VHDX files
When a Hyper-V administrator takes the first snapshot of the virtual machine, Hyper-V will create an AVHD file for each of the present disks with .AVHDX as extension. Each AVHD file is using the corresponding VHDX file as its parent.

Figure 2. Representation of disk files for the virtual machine after the first snapshot

Now, the virtual machine will do:
  • Read operations from the two (2) .VHDX files and the two (2) .AVHDX files of the first snapshot: The total number of files to read is four (4)
  • Write operations on the two (2) .AVHDX files of the first snapshot
The Hyper-V administrator decides to take a second snapshot. Here, new AVHD files will be created and will have the AVHD files from the first snapshot as parents.

Figure 3. Representation of disk files for the virtual machine after the second snapshot

The virtual machine will do:
  • Read operations from the two (2) .VHDX files, the two (2) .AVHDX files of the first snapshot and the two (2) .AVHDX files of the second snapshot: The total number of files to read is six (6)
  • Write operations on the two (2) .AVHDX files of the second snapshot
More complicated structures could be created and even having multiple trees of snapshots is possible. One example for creating a new tree for snapshots is that the Hyper-V administrator restore the first snapshot and then takes a new snapshot: A new tree will appear as shown in the following figure.

Figure 4. Representation of disk files for the virtual machine after the third snapshot

Hyper-V allows creating until fifty (50) snapshots: This is not a target but a limit.

How could Hyper-V snapshots impact a virtual machine performance?

As shown previously, when a Hyper-V administrator takes snapshots for a virtual machine; the virtual will need to read the VM data from more and more files and then the virtual machine performance will start to degrade and may even result in very poor performance.

What about the trust relationship of a Domain joined virtual machine when restoring it from a snapshot?

Restoring a Domain joined virtual machine from a snapshot may result in a computer account password mismatch.

We can take the following scenario to explain how this can occur:

The virtual is having a computer account password which is Password1.

Figure 5. Pre-snapshot representation of the computer account password for the virtual machine

The Hyper-V administrator take the first snapshot for the virtual machine. One day after, the virtual machine updated its Active Directory account password to be Password2.

Figure 6. Post-snapshot representation of the computer account password for the virtual machine

When the Hyper-V administrator restores the first snapshot, the virtual machine will think that its computer account password is Password1 as all the changes since the snapshot capture were removed. When the virtual machine will communicate with Active Directory, it will refuse the authentication because of the computer account password mismatch. This results in a broken secure channel.

Here, disjoining and joining again the virtual machine to Active Directory will fix the issue. However, you need to note that if you remove the computer account in AD and create a new one, the computer account will have a new SID and any SID-based permissions will be broken.

Management of SIDs in Active Directory:

Is restoring virtual machine from a Hyper-V snapshot supported?

Hyper-V itself supports restoring virtual machines from snapshots. The applications and the operating systems running on the virtual machines might not support this operation. A typical example here are Domain Controllers running Windows Server 2008 R2 or a previous version as you may face a USN rollback issue after the restore (This was improved with Domain Controllers having Windows Server 2012 OS higher when they are running on Hyper-V 2012 or higher).

This is well described in the references below:

USN Rollback, Virtualized DCs and improvements on Windows Server 2012:

How to detect and recover from a USN rollback in Windows Server 2003, Windows Server 2008, and Windows Server 2008 R2:

Before thinking about taking snapshots for virtual machines, you need to check first the compatibility of the running operating systems and applications with their vendors/developers. This is to avoid having bad surprises and impacts on environments you manage. It is true that snapshots are easy to capture and restore but this does not mean that it is a safe option to restore a virtual machine to a previous state.

Is there other disadvantages for using snapshots?

Yes, there is.

Let’s start with the virtual machines with fixed virtual hard disks. Using fixed virtual disks for virtual machines provide better performance compared to using dynamic ones. This can be clearly seen for virtual machines that are heavy in terms of disk I/O usage. By taking a snapshot for these virtual machines, you will lose the performance benefits you had from using fixed virtual disks.

Another consideration you need to note is that snapshots require adequate storage space. This is because, due to the creation of AVHD files, your LUNs may become full and Hyper-V will then pause the virtual machines running on these LUNs. This explains how snapshots for VMs may significantly impact your environment if it is not properly managed.

Note also that Hyper-V snapshots are not a replacement for snapshots created by Volume Shadow Services (VSS) and you should not expect the same results.

Why are snapshots still available in Hyper-V with all of these disadvantages?

To summarize what was previously mentioned: Hyper-V snapshots are not recommended to be used in production environments due to performance impacts and the fact that they are not a replacement of VSS. However, using snapshots in test environments or labs can be helpful. Below are two examples for that:

Example 1:

You are planning to install a new application in a test environment. You have already deployed a new virtual machine running Windows Server 2012 R2 as an operating system and installed all the application pre-requisites. You are now going to start the installation of application and you are afraid that, if the setup goes wrong, you will have to re-install the operating system and the pre-requisites. Here, you can consider taking a snapshot of your virtual machine so that you can restore it if the application setup fail and you need to get back to previous state. Here, using a snapshot would be an efficient and easy option you can think about.

Example 2:

You are preparing a virtual lab for students and you would like to be able to easily get your VMs back in time when the course finish and you need to start a new one. Here, you can take a snapshot of your LAB VMs and restore them all when the course is finished: You may face some issues but this remains easier than restoring the VMs from backups.