Creating an image on Nutanix AHV can be challenging, so I have created a guide to simplify the process.

  1. Identify the VM name of what you will be creating an image of. Ensure the VM is shutdown and in the off state. You will also need the name on the storage container the disk is stored in.
    ***Recommended that you sysprep the vm before shutdown***
  2. Connect to any CVM and run the following command.
nutanix@cvm:~$ acli vm.get vm_name

3. Locate the vmdisk_uudi in the disk_list section of the output.

disk_list {
      addr {
        bus: "scsi"
        index: 0
      container_id: 162303742
      container_uuid: "0f546883-e689-4ccf-a87e-9ee8c38c365a"
      device_uuid: "569d470e-d95e-4110-b956-d200c3e2d71d"
      naa_id: "naa.6506b8dbf653c48d008a37cddc9b17b2"
      vmdisk_size: 161061273600
      vmdisk_uuid: "ee285c4b-60c5-402b-bb18-099638e10381"

4. Build and Execute the image creation command. In the example, we create an image named test image from a VM disk located in ContainerA. The image will be created in the container DiskImages.

nutanix@cvm$ acli image.create test_image source_url=nfs:// container=DiskImages image_type=kDiskImage

Bonus: Use this command to sysprep a windows machine, preparing it for image creation.

%WINDIR%\system32\sysprep\sysprep.exe /generalize /shutdown /oobe /mode:vm