I have seen some asks around virtual machine export from Nutanix Acropolis Hypervisor (AHV). To export VM form Nutanix AHV we will use qemu-img Linux tool and export VM into qcow2 format.
Below quick guide on how to export VM from Nutanix AHV.
Requirements:
- Acropolis Base Software 4.6.X or newer
- AHV 20160217 or newer
Step #1 – identify VM disk UUID
Log in to CVM via ssh and get into Acropolis command line – type acli. First, list VM <vm.list>. Seconds, check virtual machine disk UUID <vm.get VirtualMachineName> . Search for line named vmdisk_uuid and note it down
<acropolis> vm.list VM name VM UUID ArturTest01 b8aa233a-c558-4aed-9dd5-b4795907c2da <acropolis> vm.get ArturTest01 ArturTest01 { config { disk_list { addr { bus: "ide" index: 0 } cdrom: True empty: True } disk_list { addr { bus: "scsi" index: 0 } container_id: 8 source_vmdisk_uuid: "3f294837-36dd-4d0d-a766-71113c68e5fd" vmdisk_size: 64425558016 vmdisk_uuid: "7e80401c-003a-4a43-add8-645af5d7db58" } memory_mb: 6144 name: "ArturTest01" nic_list { mac_addr: "52:54:00:6a:c7:61" network_name: "VLAN92" network_uuid: "8e06c992-7543-48f7-9380-51493b09317b" } num_cores_per_vcpu: 1 num_vcpus: 2 } host_name: "c04nodea.gso.lab" host_uuid: "3e15fc7d-8427-4572-9636-2237d828d28c" logical_timestamp: 2 state: "kOn" uuid: "b8aa233a-c558-4aed-9dd5-b4795907c2da" }
Step #2 – run qemu-img and export disk to qcow2 file format.
Run qemu-img from CVM
nutanix@NTNX:~$ qemu-img convert -f raw -O qcow2 -c nfs://<cvm_ip>/<container>/.acropolis/vmdisk/<vmdisk_uuid> nfs://<cvm_ip>/<container>/<vmdisk_name>.qcow2
NOTE #1: make sure VM is powered off before you export it.
NOTE #2: if you put only qcow2 filename at the end of the command, qcow2 file will be created iin the path you run command from.
NOTE #3: make sure to use output path for file with enough free space
nutanix@NTNX-15SM65300246-A-CVM::~$ qemu-img convert -f -c raw nfs://127.0.0.1/default-container-32395/.acropolis/vmdisk/7e80401c-003a-4a43-add8-645af5d7db58 -O qcow2 nfs://127.0.0.1/<container>/ArturTest01.qcow2
After several minutes ( waiting time greatly depends on vm disk size, hardware platform, CVM resources utilization) you should have file ready for download from Nutanix Container. Add your workstation\server IP (if windows it has to be Windows 2012R2 or Windows 8.1 or newer) to container whitelist and you can browse is image file.
Hi Artur,
I am not able to convert images.
I follow this command on my machine.
qemu-img convert -c .acropolis/vmdisk/9450e545-033b-4959-b7f8-4f8e1bd04d4e /home/Ankit/MC.qcow2
getting error: ************************
qemu-img: Compression not supported for this file format
*****
I just install on ubuntu machine
sudo apt-get install qemu-img
is there any more need to conversion…
Thanks you
[…] command to export a VM. So i wrote a script which helps with this part based on the great post from Artur […]
Artur I did all this successfully, how do you then bring it back into a new block for restoration on a new install? Re-convert the image back to raw format? Then how do you bring them VM back into use?