William Beckett

[How to] Remove Old Snapshots on Nutanix AHV

Sometimes when deleting VMs you can forget to check if the VM you are deleting has existing snapshots prior to it being deleted resulting in orphaned snapshots hanging around on the cluster. This can also happen when VMs are being deleted by API (when using something like Citrix App Layering) and the API call doesn't delete the existing snapshots.

Luckily we can use acli to remove these old snapshots and restore order to your cluster once more.

acli

To clean up your old or orphaned snapshots, SSH to your cluster IP address (or directly to a CVM). Now you'll want to switch over to the acli prompt. If you switch to the acropolis prompt you'll be able to make use of handy tab completion
acli
This will give you the acropolis prompt.

acli prompt

Now you can list the existing snapshots on your cluster with:
snapshot.list

snapshot list

As you can see, I have a lot of snapshots on the cluster. I want to remove all the snapshots that Citrix Applayering has left behind. these are the snapshots starting with XDSNAP_. To achieve this I use the below command.
snapshot.delete XDSNAP*

This command will ask me if I want to go ahead and delete all snapshots that start with XDSNAP. Once confirming, I will be able to see the result against each snapshot name.

snapshot delete

To confirm my snapshots have been deleted I can run snapshot.list once again to view the snapshots on the cluster.

clean snapshot list

All my old or orphaned snapshots are now gone and my cluster makes sense again.