Nutanix : Get Size of AHV Snapshots


While working on a AHV cluster, you can notice that, with time, the storage decreases. This is obvious, all VMs are using thin-provisioning by default. Doing some cleanup and maintenance is required on every IT systems and Nutanix does not escape the rule. One area where we are not focusing enough is the snapshots we are creating and most of the time forgot !

API to the Rescue !

First, we need to understand the process on how snapshots are stored on Nutanix. You need to find the VM Uuid.


"uuid": "0e2a6636-88b5-45b4-95c2-3005c98ff53b"

Next, using the Uuid above, you can get the details about the snapshots.

Sample snapshot Group_Uuid :  

"group_uuid": "d0b2f346-fbcb-4abf-a5c9-02bf6c188103"

This group Uuid is important, it will tell us where to look in the AHV folder structure to get the real size.

To construct the URL above, you need to follow this syntax : 


Sample result :

"entities": [


      "name": "bddca8d3-b8a5-4181-95ce-62cedf6e3369",

      "total_size": 64424509440,

      "used_size": 45008316928,

      "file_type": "file",

      "file_path": "/NTNX-NFS-DEFAULT/.acropolis/snapshot/d0b2f346-fbcb-4abf-a5c9-02bf6c188103/vmdisk/bddca8d3-b8a5-4181-95ce-62cedf6e3369"



You can get the Container name by looking at the VM details in the Prism UI but we are API-minded here so, let get the container name from another API set.

Let's get the VM details including the disk information : 

Get disk who is not a CDROM (SCSI type)


    "disk_address": {

        "device_bus": "scsi",

        "device_index": 0,

        "disk_label": "scsi.0",

        "ndfs_filepath": "/NTNX-NFS-DEFAULT/.acropolis/vmdisk/bddca8d3-b8a5-4181-95ce-62cedf6e3369",

        "vmdisk_uuid": "bddca8d3-b8a5-4181-95ce-62cedf6e3369",

        "device_uuid": "6c20cafb-a3ae-49b0-8c75-9a0253dba0ce"


      "is_cdrom": false,

      "is_empty": false,

      "flash_mode_enabled": false,

      "is_scsi_passthrough": true,

      "is_hot_remove_enabled": true,

      "is_thin_provisioned": false,

      "shared": false,

      "storage_container_uuid": "267b4ada-f87c-4741-93cc-1a85e72fffaa",

      "size": 64424509440,

      "data_source_url": ""



With the storage_container_Uuid we can get the name with another API call :

      "name": "NTNX-NFS-DEFAULT",

With this, I have integrated few new functions into my Php Framework : 

function nxGetVMUuid($clusterConnect,$vmName)

function nxGetVMSnaps($clusterConnect,$uuid)

function nxGetVMContainerName($clusterConnect,$vmUuid)

function nxGetSnapSize($clusterConnect,$containerName,$groupUuid)

Those functions allow me to parse an entire Nutanix cluster and search for snapshots for each VMs, the size of them and the potential savings if you remove them.

Last comment : once the space is reclaimed after snapshots have been removed, you need to wait to see the real effect in your available storage container. Indeed, the space will only be flushed after 2 curator full scans (by design).

Big thanks to Bilel Kammoun from for his support and to the Nutanix Engineering team for the validation of the procedure.

My Php framework who embeds the above functions is here and the sample script which analyze a full cluster is here.

Hope this helps!


  1. How to use the script or execute it ??

    1. Hi, simply get the relevant scripts from here : then you need to provide your credentials in the nxCredentials.php. then execute it with php nxGetSnapshotSize.php ...


Post a Comment

Thank you for your message, it has been sent to the moderator for review...

What's hot ?

Wallbox : Get The Most Of It (with API)

PCBWay : CNC Machining

Nutanix : CVM stuck into Phoenix