Export a VM from AHV raw format to VMware VMDK

In this example I’m going to export my Windows 2012 R2 template from AHV to ESXi.

Step 1: Find UUID of the vDisk.

Connect to a CVM, enter aCLI and run the command vm.get [vm name]

Copy the vmdisk_uuid.  (Notice the size of the VM under the STORAGE column in PRISM, that should be the size of the exported file… assuming the VM only has 1 vdisk)

image

image

 

Step 2: Export the vDisk

vDisks of AHV VMs are located in a hidden folder on the container named .acropolis.  We use the qemu-img command to export the vDisk.  The vdisk is exported in a thin format and should match the size of the VM in PRISM.

Make sure the VM is powered off, then run the following command:

qemu-img convert –O vmdk nfs://127.0.0.1/[container]/.acropolis/vmdisk/[UUID] nfs://127.0.0.1/[container]/[vmdisk].vmdk

Example:
qemu-img convert -O vmdk nfs://127.0.0.1/Nutanix/.acropolis/vmdisk/838950be-d0d8-4132-bf8f-e02411807cf2 nfs://127.0.0.1/Nutanix/win2012r2.vmdk

 

Step 3: Copy the vDisk

Once the export completes, you can now whitelist a Windows 2012 R2 server and simply browse to the container and copy the vDisk and import it into ESXi.  Alternatively you could just mount the container as NFS on the ESXi host and storage vMotion it to another datastore.

image

 

Step 4.  Create a VM with the new vdisk and power it on.  Remember to install VMware Tools.

image

Leave a Reply

Your email address will not be published. Required fields are marked *