One of the nice feature of virtualization, being able to take a snapshot (checkpoints are also knows as snapshots), can later come back to get you. For this reason, it’s not a good idea to take checkpoints in a production environment. If you do take a checkpoint for some reason, be sure to erase it as soon as possible.
I have run across many servers with multiple snapshots spread over years. Deleting these old checkpoints can be time consuming, stressful and occasionally downright ugly if you run out of disk space. Before deleting snapshots, make sure you have enough free disk space.
You can see the snapshot’s size by right clicking on it, selecting settings and then clicking on the inspect button or by visiting the folder where your aVHDX files are stored.
To be safe, you should have enough disk space free to accommodate the combined size of the main VHD file plus all the snapshots that you are going to merge. When you delete a snapshot, it merges the file into another snapshot. This happens until all snapshots have been deleted and merged. At this point, the last snapshot will merge to the main VHD file. The following is a brief analysis based on my own experience in a lab environment so results may vary depending of the differencing capacity between your files. But you should use the worse case scenario capacity requirement shown below.
How the Checkpoint Merge Requires Disk Space
Example: You have a 100 GB VHD and two 25GB snapshots, here’s what will happen when you delete a snapshot:
A 25 GB avhdx file will merge into another 25 GB avhdx file creating a 50GB avhdx file. The merge file will grow to 50GB before the old 25GB file is deleted so you will need an extra 25GB space to complete this process.
When you delete the second snapshot, the 50 GB avhdx will merge with the remaining 25GB avhdx creating a 75GB avhdx. The merge file will grow to 75 GB before the old 50 GB file is deleted, so you will need an extra 50GB space to delete the second checkpoint.
When you delete the last snapshot, the 50 final GB avhdx will merge with the original 100GB VHD file creating a 150 GB avhdx. The merge file will grow to 150 GB before the old 50 GB file is deleted, so you will need an extra 50GB space to delete the second checkpoint.
This is the reason you need enough free space to accommodate the size of the original VHD plus all the avhdx (snapshot) files combined.
What if you don’t have enough free space to merge the checkpoints?
If you do not have enough disk space available, there are three options:
- If you have Hyper-V 2012R2, you can export the VM to another disk. It will be exported as a merged VHD file. Later on, clear out the original VM and import the merged image.
- You can live migrate the VM to another server that has ample disk space, complete the checkpoint merge, then move it back. This will minimize downtime since you can live migrate and merge without having to turn off the VM if you have Hyper-V server 2012 R2.
- You can move the VM to another volume, such as a USB drive, complete the merge, them move it back again.
How to Move the VM to another Volume and Complete the Checkpoint Merge
Before proceeding, make sure that you have a backup. If you can move it to a volume mounted to the SATA or SCSI interface, it would be faster and more reliable than using an external USB drive. If you are using Hyper-V 2012R2, you can perform the following steps while your VM is on, otehrwise you must shut down the VM first.
Right click on the VM and select move. Choose to move the VM’s storage.
Select the option you want then the storage location.
Depending on the size of the VM and its snapshots, it may take a while.
In our lab, it took about 1 minute per GB to move to a USB 3.0 external drive.
Once the move has completed, proceed to delete the checkpoint.
When the merge completes, repeat the above steps to move the VM back to its original location.