In some scenarios, we might have a need to find the disks associated with a virtual machine hosted on a Nutanix AHV Cluster.
Nutanix offers a distributed storage fabric, which forms a large storage pool across “N” number of nodes. we then create containers for different types of workloads or we can easily use a single container as well.
Virtual Machines are created via Prism Management and all vDisks associated with the VMs are hosted on the distributed storage pool.
On a Nutanix AOS Cluster, Acropolis service runs across the cluster to manage virtual machine operations and configurations. As both Data & MetaData is distributed across the cluster, we can use the “Acropolis” service on almost any CVM to retrieve virtual machine information running on any node.
In order to interact with the Acropolis service, Nutanix offers “acli”. a powerful set of commands for virtual machine operations across your Nutanix cluster.
acli offers tab-completion once inside the acli shell or we can execute the acli commands from a normal cvm prompt as well.
Find disk or disks attached to a existing virtual machine:
I need to find the Disk (100GB) attached to a VM called “WServer2019” on a Nutanix AOS - AHV cluster.
To query Virtual Machine configuration via acropolis cli <
acli>, we will use the “
vm” namespace, which offers us
vm.disk_get to find disk information of a virtual machine.
By retrieving Virtual Machine Information :
SSH to a CVM on the same cluster. “nutanix@cvm-ip”
From the CVM command shell:
nutanix@NTNX-CVM:192.168.100.1:~$ acli vm.get <vm-name>
acli vm.get command will give us all the relevant information related to a virtual machine or in simpler terms, it will output virtual machine config, (CPU | RAM | Disks | Controllers | Location)
As we are interested in finding the disks and their location on one of the containers on our cluster, we could do the following:
acli vm.get WServer2019 include_vmdisk_paths=1
Above command will output the Entire VM Configuration for WServer2019, out of which we will be interested in the ‘disk_list’ section.
Note, we have used the “include_vmdisk_paths=1” in order for the output to include the actual path where the vdisk resides. Following section “disk_list” will give us the desired information:
Looking at the output above, we can see the “vmdisk_nfs_path” is pointing to a container called “ctr01” and the hidden directory called “.acropolis” which holds all vmdisks inside the vmdisks folder.
By retrieving VIRTUAL DISK Information for a given VM :
We can also drop inside the “acli” prompt and get the desired information (as above) via the “vm.disk_get” command:
acli vm.disk_get <vm-name>
in the following snippet we are inside the
acli shell / prompt:
<acropolis> vm.disk_get WServer2019 include_vmdisk_paths=true
the “vmdisk_uuid” and the location is of our interest here, which we can later use to either clone the disk as an image or download this disk by connecting to our cluster via WinSCP - more on that later.
Things to remember:
- acli can be executed directly from a CVM
- acli commands can also be executed by entering the acli shell / prompt
- acli can be executed from any cvm on a AOS cluster
- acli vm.get (to List Virtual Machine info)
- acli vm.disk_get <VM-NAME> (to retrieve disk information of a vm)
Stay tuned for the next part - where we will find and access disk of an existing virtual machine via WinSCP in order to download it to our workstation.