You need to expand the virtual disk size of a Hyper-V virtual machine (VM) but you are not allowed to proceed, even when the VM is shut down, because there are Hyper-V checkpoints. This KB article provides guidance on how to merge Hyper-V checkpoints.
You first check the user-generated checkpoints and realize that there are no user-generated checkpoints available.
You therefore need to merge the system-generated Hyper-V checkpoints, in order to be able to expand the virtual disk size.
In cases where you have a Microsoft or third party backup tool, the backup tool will normally make use of the Hyper-V checkpoint mechanism when taking backups. Generally, the backup tool requests Hyper-V to create a checkpoint for the virtual machine as part of the VM backup process. After the backup tool completes the backup, it sends a backup complete notice, and then Hyper-V merges the checkpoint back into the primary .vhdx file and deletes the .avhdx file. If this does not happen for some reason, you end up with a broken chain of checkpoints which have not been automatically merged.
This how-to article provides step-by-step guidance on how to merge Hyper-V checkpoints by using the Hyper-V graphical management console. You can carry out the same task also by using Powershell.
- Before proceeding, consult the following MS article: https://learn.microsoft.com/en-us/troubleshoot/windows-server/virtualization/merge-checkpoints-with-many-differencing-disks. You may need to follow a different approach (e.g. utilize the Microsoft-provided Get-VHDChain function) from the one presented in this KB article, depending on your scenario.
- Always ensure that you have full backups of your Hyper-V virtual machines before proceeding with any Hyper-V checkpoint merge operations. Alternatively, you can export your VM in Hyper-V Manager console, to ensure that you have a recoverable copy of the VM in case of a disaster. If the merge procedure is not performed correctly, data loss may occur. Proceed at your own risk! – Review the following article to see a description of the risk of data loss and what to do to protect against this scenario: https://blog.workinghardinit.work/2014/08/29/manually-merging-hyper-v-checkpoints/.
- If you are running a third party backup solution, your backup solution may be controlling the automatic creation of Hyper-V checkpoints in the background. In this case, you need to consult the backup solution documentation first. The following articles provide further guidance on this:
It is therefore essential to consult your third party backup documentation and/or support team, to ensure that you have the proper configuration in place for Hyper-V checkpoint operation and automatic merging to occur without issues. One such example in the case of the Acronis Cyber Protect 15 software is that you may need to disable the “multi-volume snapshot” option in the Acronis Cyber Protect 15 plan settings. This should eliminate any issues you may be facing with checkpoint merging in Hyper-V.
Carry out the following steps to manually merge Hyper-V checkpoints.
First check in the VM settings to document the Hyper-V checkpoint storage path, as shown in the example below.
Snapshot files for Hyper-V virtual machines are stored in the .avhd(x) file format in the same folder as a parent hard disk image file. Hyper-V snapshots are differencing virtual disks and they have a parent-child relationship with the corresponding parent virtual hard disk. A maximum of 50 snapshots are permitted for each virtual machine. The Hyper-V snapshots are organized in a hierarchical order.
The first thing you need to do is created a hierarchy structure of all .avhd(x) files to map each avhdx file to its immediate parent disk, until you reach the top vhd(x) disk.
To merge Hyper-V snapshots, do the following:
- Open Hyper-V Manager.
- Select the required VM.
- Click Edit Disk. The Edit Virtual Hard Disk Wizard will open. Click Next.
- Click Browse to select the most recent .avhdx file. Click Next.
- Select Merge to merge the changes stored in a differencing disk into the parent disk. Click Next. Select To the parent virtual hard disk and click Finish.
- The merge process shall be carried out.
- To complete the merge process for all checkpoints, repeat the above steps for each .avhd(x) file until all of the changes have been successfully merged into the top-level parent disk.
- You can now power on the VM and verify operations.
The above instructions are applicable when you need to merge system-generated Hyper-V checkpoints, which do not appear in the checkpoints area of the Hyper-V Manager console. If you need to merge a user-generated checkpoint which appears in the Hyper-V Manager console, you need to consult the following Microsoft KB article: https://learn.microsoft.com/en-us/troubleshoot/windows-server/virtualization/merge-checkpoints-with-many-differencing-disks. Checkpoints which are visible in the Hyper-V Manager console are the most straight forward to handle. Usually, you can use the Delete Checkpoint command on the context menu to delete these checkpoints. In some cases, Delete Checkpoint and Delete Checkpoint Subtree don’t appear on the context menu. This can occur if third-party backup software generates checkpoints but doesn’t delete them after a backup operation. In these cases, you can still use the Delete key on the keyboard to delete the checkpoint.