Welcome to Microsoft Q&A,
Thank you for taking the time to provide these details. It's a good step that you're creating an export as a precaution before making any changes.
In general, do not manually delete AVHDX or checkpoint files from disk. If the checkpoints are still visible to Hyper-V, using PowerShell is the supported approach.
The following command: Get-VMSnapshot -VMName "VMName" | Remove-VMSnapshot (or Remove-VMCheckpoint on newer versions of Hyper-V) is a supported Hyper-V cmdlet that removes checkpoints through Hyper-V and initiates the required merge process. Deleting a checkpoint does not discard the VM's current state. Instead, Hyper-V merges the associated AVHDX files back into the parent virtual disk while preserving the latest data and changes.
- Regarding your questions:
1. Is it safe to run?
Generally, yes. As long as the checkpoint chain is healthy and you have a valid backup or export available, this is the supported method for checkpoint removal. The cmdlet does not directly delete the VM's virtual disk.
2. Will it remove all 6 checkpoints?
Yes. Since Get-VMSnapshot returns all checkpoints for the specified VM and passes them to Remove-VMSnapshot, all six checkpoints would be processed for removal.
3. Will it merge the changes before removing them?
Yes. Hyper-V merges the checkpoint data into the parent disk as part of the checkpoint removal process, ensuring the VM retains all updates and changes contained within the checkpoint chain. Depending on the size of the checkpoints and storage performance, the merge operation may take some time to complete.
- Regarding Hyper-V Replica
A planned failover to the replica host followed by deleting and recreating the replication relationship is not typically recommended as a method for removing orphaned checkpoints. While rebuilding the replication relationship may create a new replication chain, it does not guarantee that orphaned checkpoint metadata or AVHDX files will be cleaned up. It also introduces additional complexity and risk compared to addressing the checkpoint issue directly.
Since the checkpoints may have been created by a backup application, I would recommend the following before proceeding:
- Verify that no backup jobs are currently running.
- Check whether the backup software has left behind any recovery or backup-related checkpoints.
- Complete the VM export or ensure you have a recent backup.
- Use
Get-VMSnapshotto confirm which checkpoints Hyper-V currently recognizes. - Remove the checkpoints using the supported Hyper-V cmdlets.
If these checkpoints are truly orphaned and do not behave like normal Hyper-V checkpoints, additional investigation of the AVHDX chain and the backup application's logs may be required before attempting any manual repair actions.
As the backup jobs are already failing on this VM, I would strongly recommend confirming that your export or backup is valid before removing the checkpoints. Backup-generated recovery checkpoints can occasionally become orphaned if a backup operation was interrupted or did not complete successfully.
Reference: Remove-VMSnapshot (Hyper-V) | Microsoft Learn
If you find this information helpful, please consider clicking Accept Answer.
Thank you for using Microsoft Q&A.