Tuesday, 22 October 2013

Hyper-V Snapshot - Pros and Cons

What is a Hyper-V Virtual Machine Snapshot?

  • Hyper-V virtual machine snapshots allow the status of a virtual machine (and the corresponding guest operating system) at a particular time to be saved such that it can be reverted to that state at any point in the future.
  • Hyper-V snapshots contain both the configuration settings of the virtual machine, and the state of the guest operating system at the point the snapshot is taken.
  • Snapshots may be taken of virtual machines when they are running, stopped or saved. It is not possible, however, to take a snapshot of a paused Hyper-V 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.

Creating a Snapshot
  • You can create a snapshot by selecting the VM and select Snapshot from the Actions pane in Hyper-V Manager. The status of the virtual machine will change to “Taking Snapshot” and show the progress of the action using a percentage value.
  • By default, the snapshot is named after the virtual machine and shows the date and timestamp of the snapshot. You can rename the snapshot to something more descriptive.
  • You can also view the settings of a snapshot to observe the specification of the virtual machine at the time of snapshot creation.
  • You can create up to 50 snapshots of a single virtual machine.

  • Note that the current state of the virtual machine is highlighted as Now, a child of a snapshot. The way to interpret this is that the virtual machine has had changes since the parent snapshot of Now was created or applied.

Applying and Navigating Between Snapshots
You apply a snapshot to roll a virtual machine back in time. To do this, select a snapshot and select Apply.  A dialog will open to ask you how you want to proceed. You can:
  • Cancel the creation of a snapshot
  • Apply the snapshot and abandon all changes since the last snapshot
  • Create a new snapshot to capture all changes since the last snapshot, and then apply the old snapshot

  • Using Take Snapshot And Apply, you can create a more complicated hierarchy of snapshots.

Note that applying a snapshot will also revert the specification of a virtual machine if it was changed since the snapshot was created.

Deleting Snapshots

  • Starting with Windows Server 2012 (and Windows 8), when you delete a Snapshot Hyper-V will perform a live merge of the snapshot without powering down the virtual machine. This merge might be delayed by a few minutes, but it will happen.
  • Please remember that any dynamically expanding virtual machines will need to expand before their child AVDH/X file(s) can be merged. This might be an issue if snapshots filled the LUN the virtual machine was stored on – move the virtual machine and perform the merge. Fixed virtual hard disks don’t have this issue.
  • You can select a snapshot and choose the Delete Snapshot action to delete a snapshot. To delete a collection of snapshots, select the top snapshot that you want to delete, and choose the Delete Snapshot Subtree action.
  • Deleting a snapshot will merge your .avhdx and .vhdx file into a final .vhdx file

Caution: Do not delete .avhd files directly from the storage location. Instead, use Hyper-V Manager to select the virtual machine, and then delete the snapshots from the snapshot tree.
Do not expand a virtual hard disk when it is used in a virtual machine that has snapshots. Doing so will make the snapshots unusable.

Problems faced with Snapshots if kept for long time

  • Virtual machine pauses automatically. Hyper-V Manager shows the status as ‘paused-critical’
Fix: To fix the problem, create additional space on the drive by deleting unused data.

  • Deleting snapshots, but they failed to merge because there is not enough space on the disk (error 0x80070070)
Fix: If possible, free up storage space on the volume where the .vhd file is located. In some cases this might not be possible. For example, the space is occupied by .vhd and .avhd files only. If you cannot free up space on the current volume, export the virtual machine to a volume that has sufficient disk space to allow the merge to complete. The process of exporting the virtual machine to delete snapshots consists of the following steps:
  1. Export the virtual machine from the current location.
  2. Import the virtual machine to a location that has sufficient storage space. The location should be a different volume on the same host to avoid configuration problems.
  3. If the version of Hyper-V is earlier than Windows Server 2008 R2, turn on the virtual machine and then shut it down, to trigger the merge process at the new storage location.
  4. If you want to move the virtual machine back to the original location, free up additional space. Then, import the virtual machine back to the original location.


  • Only recommended for special occasions e.g. before a risky operation like attempting an application upgrade, etc.
  • Freezes a VHD file, and creates a differencing VHD (AVHD) on top of the VHD
  • Makes it more tedious to migrate from one host to another
  • Major impact on performance
  • Not recommended to leave snapshots hanging around! Remove when you’ve satisfied yourself that it’s no longer needed.

1 comment:

  1. There is noticeably much to experience this. I believe you made several well points in Features as well. http://www.lowhosting.com/justhost-review/