Hyper-V checkpoints play a key role in the overall lifecycle management of Hyper-V virtual machines as they allow for effectively managing and performing software updates, upgrades, and installations with an effective rollback mechanism when things go badly.

In the latest releases of Hyper-V, Microsoft has enhanced and added to the checkpoint functionality with even more robust features including production checkpoints and utilizing the benefits of the ReFS file system. After Hyper-V checkpoints are used however, getting rid of the checkpoints once they have served their purpose is certainly the best practice procedure in managing Hyper-V checkpoints.

We have covered How to create Hyper-V Checkpoints and Managing Hyper-V Checkpoints in our previous posts.

In this post we’ll take a look at the following:

  • Why Hyper-V Checkpoints need to be merged
  • How to merge Checkpoints using Hyper-V Manager, and PowerShell
  • How to manually merge Hyper-V Checkpoints

Why Hyper-V Checkpoints Need to be Merged

While checkpoints provide tremendously powerful functionality for remediating failed software updates or other issues related to changes made to a Hyper-V VM, they need to be managed properly. Proper management of Hyper-V virtual machines involves making sure checkpoints are merged back into the base disk.

Download Banner

What does this involve?

Checkpoints work by creating “delta” disks that house all the new writes to a virtual machine disk. This ensures that any new data changes are made to the delta or “differencing” disk. This provides the protection against failed software updates or other changes made to the virtual machine as if these are not successful, the checkpoint can simply be reverted and the virtual machine is back to the state it was in before the changes were made.

If it is decided to keep the changes made to a virtual machine after a checkpoint was created and the software update or other changes were deemed successful, it is time to merge the checkpoint. The merge operation basically integrates all the changes made to the virtual machine captured in the differencing disk (AVHDX file) back into the base virtual disk. The end result is the base disk contains all the data and changes made to the virtual machine as if the checkpoint was never created and all changes were simply captured in the base disk. Even though we know this was not the case, this is the magic of virtualization and Hyper-V checkpoints.

Checkpoints are not meant to be a permanent fixture of a Hyper-V virtual machine. In fact, keeping checkpoints around long-term can lead to undesirable effects such as performance degradation. Having multiple checkpoints on a Hyper-V virtual machine leads to inefficiency in the way disk I/O is performed on a Hyper-V virtual machine. Even though all writes on the virtual machine are captured in the current checkpoint AVHDX file, data that is read from the virtual machine may have to traverse numerous checkpoints and the base disk which leads to disk latency and poor performance after time. Checkpoints will continue to grow on disk the longer they are left on a Hyper-V virtual machine.

Keeping checkpoints merged and the virtual machines clear of longstanding checkpoints ensures performance is optimal and space is not unnecessarily being consumed. When unnecessary checkpoints are in existence on a Hyper-V virtual machine, there is more likelihood of corruption of the virtual disks.

Additionally, unnecessary checkpoints in existence on a Hyper-V virtual machine can lead to data protection solutions not being able to effectively make use of Resilient Change Tracking mechanisms to ensure only the changes are copied across since the last backup operation was performed.

These are some of the more important reasons that Hyper-V checkpoints need to be managed in such a way that unnecessary checkpoints are merged appropriately and in a timely manner. Lingering checkpoints lead to issues across multiple fronts.

Since it is well established that Hyper-V checkpoint merge operations are a necessary best practice to keeping a Hyper-V environment running efficiently and performing as expected, let’s take a look at the various methods for merging Hyper-V checkpoints.

Merge Hyper-V Checkpoints with Hyper-V Manager

Generally, most Hyper-V administrators will resort to using Hyper-V Manager as the tool of choice if they have only a single Hyper-V checkpoint that needs to be merged on a single virtual machine. Hyper-V Manager provides an easy and intuitive GUI interface to merge checkpoints.

The checkpoint tree as it is called provides a hierarchical view of the checkpoints in existence on a Hyper-V virtual machine. Hyper-V can house 50 checkpoints per VM using Hyper-V Manager. With System Center Virtual Machine manager or SCVMM, this limit can be extended out to 64 checkpoints.

A merge operation is simply a deletion of the snapshot with the realization in the background – the process is merging the data into the base disk instead of simply deleting the data.

To perform this deletion/merging of a Hyper-V checkpoint, you can simply right-click on the snapshot in question and it will yield the Delete Checkpoint and the Delete Checkpoint Subtree option.

  • Delete Checkpoint – This deletes the single checkpoint that you have focus on.
  • Delete Checkpoint Subtree – This option will delete the currently highlighted checkpoint and everything after it. This is due to the “subtree” checkpoints are built from the checkpoint previously created.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Deleting a Hyper-V Checkpoint by using the Delete Checkpoint or Delete Checkpoint Subtree options

Merge Hyper-V Checkpoints with PowerShell

Using PowerShell to manage and merge checkpoints is a great way to perform these operations in Hyper-V at scale.

GUI management certainly has its place and can be used effectively for one-off checkpoint management tasks. However, if you are dealing with dozens or maybe even hundreds of hosts with virtual machines running checkpoints that may need to be merged, PowerShell is a great way to perform merge operations in an automated way.

To remove all the checkpoints found on all VMs on the current Hyper-V host, it is a simple one-line PowerShell command:

  • Get-VM | Get-VMSnapshot | Remove-VMSnapshot

If you wanted to remove a checkpoint across multiple hosts, you can use a simple “for” loop to accomplish this, why getting the nodes in a cluster and then looping through these to get a list of VMs and then deleting any checkpoints that exist.

$hvnodes = get-clusternode | select name -expandproperty name

foreach ($hvnode in $hvnodes) {

Get-VM -computername $hvnode | Get-VMSnapshot | Remove-VMSnapshot

}

How to Manually Merge Checkpoints in Hyper-V

There may be cases where you need to manually merge your Hyper-V checkpoints in the case of corruption or failure with merging your checkpoints via the normal means.

Let’s look at how you can manually merge a Hyper-V checkpoint(s) into the parent disk.

As you can see, we have a VM with an existing checkpoint. Select the VM in Hyper-V Manager, under Actions click Edit Disk.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Beginning the process to manually merge a checkpoint

Click Next to proceed.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Beginning the Edit Virtual Hard Disk Wizard

You will be presented with the Locate Virtual Hard Disk screen. Click Browse to locate the AVHDX file you want to merge.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Browse to locate the AVHDX file

After you have selected the AVHDX file, click Open. This will return you back to the Locate Virtual Hard Disk

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Select the AVHDX file

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

The AVHDX selected and read to merge

The next screen is the Choose Action screen. Here select the Merge option.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Selecting the Merge action for the AVHDX file

We are merging the changes from the differencing disk back into the parent virtual hard disk. However, you can merge it into a completely new virtual hard disk also.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Select the Parent virtual hard disk

One the last screen, click Finish to begin the merge operation.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

The merge operation ready to complete

The AVHDX file is successfully merged back into the parent disk. As you can see, when you look at the disk files after the merge operation, there is no longer an AVHDX file, only the VHDX.

To use the newly merged file, create a new virtual machine and point the virtual machine to the manually merged file. If you simply keep it on the original VM, you will receive an error regarding the checkpoint chain. Below, we are creating a new virtual machine and will point it to the merged VHDX.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Creating a new Hyper-V virtual machine for the merged VHDX

On the Connect Virtual Hard Disk screen, select Use an existing virtual hard disk and Browse to the VHDX that has been merged.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Pointing the virtual machine to the merged VHDX

Select the VHDX file and select Open.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Selecting the merged VHDX file

Complete the New Virtual Machine Wizard.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

Finishing the new virtual machine wizard with the merged VHDX attached

Power ON the new virtual machine and you will have access to the merged VHDX data.

How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell

After merging the AVHDX file into the VHDX the new Hyper-V virtual machine is powered on

Concluding Thoughts

The Hyper-V checkpoint merge operation is an extremely important process that allows checkpoints to be removed properly and the data held in the delta AVHDX disks to be merged back into the base disk for the Hyper-V virtual machine. This helps to keep performance optimal for the virtual machine, corruption possibilities minimal, and allows data protection solutions to properly track changes made to the virtual machines since the last backup operation. There are many great tools that can be used for managing and merging Hyper-V checkpoints such as the Hyper-V Manager GUI tool as well as PowerShell which allows programmatically managing and merging checkpoints in Hyper-V. Additionally, manual Hyper-V checkpoint merges can be performed for various use cases.

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Like what you read? Rate us
How to Merge Hyper-V Checkpoints using Hyper-V Manager and Powershell
Rate this post