Ever wondering what will happen if you delete a Virtual Machine (VM) and keep the checkbox “Delete all snapshots of this VM” unselected?

Well it is clear that the virtual machine will be deleted and the snapshots (if exist) will stay on the cluster. But what will happen? And how do you know if colleagues did this already with virtual machines? In this blog blog I will show you how to find them, how to delete them and how to reuse them.
To prepare this blog post I created a VM (Test_VM) with a snapshot (Test_Snapshot) and deleted the VM and didn’t deleted the snapshots.
Find them:
We can find them with the NCC (Nutanix Cluster Check): ncc health_checks hypervisor_checks orphan_vm_snapshot_check
This cluster check will (default) run once every day, so you will always be notified when orphaned snapshots exist 😉

As you can see in the screenshot there is 1 orphaned snapshot found.
To get more information about this snapshot run the following command: acli snapshot.list

In my case I only have 1 snapshot in my cluster so it is easy to find the Snapshot Name. 😉
Now run the following command: acli snapshot.get <snapshot name>

Now you can decide to delete this snapshot or create a VM from it.
To check if the snapshot is still (somehow) associated to a VM run: acli vm.get <vm_uuid from the snapshot.get command>
Create VM from orphaned snapshot:
To create a virtual machines from the orphaned snapshot run the following command: acli vm.clone <VM name> clone_from_snapshot=<snapshot uuid>

Now there is a VM created which you can turn on to see what data is in the snapshot 😉 (please for best practice, do not attach the VM to a netwerk).
If you delete this VM the orphaned snapshot will not be deleted 😉
Delete the orphaned snapshot:
If you want to delete the snapshot run the following command: acli snapshot.delete <snapshot name>
