AHV - vDisk - Part - 3 : Creating an Image of or From an Existing vDISK

  • 11 November 2019
  • 0 replies
  • 3329 views

Userlevel 3
Badge +4

In our previous post, we explored “where are vdisks stored for AHV VMs and how to access or download them”. 

In this post, we will briefly go through the AOS Image service, which contains all ISO images, disk images etc.

What is AOS Image Service:

The image service feature enables you to import the images (ISOs, disk images, or any images which are supported in ESXi or Hyper-V format) directly into virtualisation management.

The raw, vhd, vmdk, vdi, iso, qcow2 disk formats are supported.

You can import images from http or NFS source URL. You can use this feature to create disks for a VM from images (images that are stored in the image library or repository) and also an option to clone from an image. You must install virtIO drivers on the image prior to importing these images into the image library.

By creating an image of an existing bootable disk or a non-bootable disk, we are publishing it in the AOS image service across the cluster. Any Cluster Admin can use this image to spin up further virtual machines or attach it as a disk

Why would we want to do that:

  1. To create a base-image for production or dev/test
  2. To persist a VM disk for later usage and attach it to an existing or new VM when required
  3. To attach a (NON-BOOTABLE) Disk of an existing VM to another VM.

To create an image from an existing VM vDISK, we would need the following details:

  • vDISK UUID (nfs_ls /container-name/.acropolis/vmdisk/)
  • vDISK Location (container name)

Creating the Image:

We will use acli (Acropolis CLI) and the 'image' namespace. we need to provide the following bits of information to acli image.create command:

1) new image name
2) source_url=nfs://127.0.0.1/source-container-name/.acropolis/vmdisk/uuid
3) target container name "container="
4) image_type=kDiskImage

acli image.create <Name of the new image> source_url=nfs://127.0.0.1/<Source_Container_Name/.acropolis/vmdisk/<vdisk-uuid> container=<target_container_name> image_type=kDiskImage

Verifying the image from acli:

nutanix@cvm$ acli image.get <image name>

Create a VM from the above created Image:

This Image can later be used as source for new VM disk, for example:

nutanix@cvm:~$ acli vm.disk_create newVM clone_from_image=VM-img

We can also use Prism > VM > Create VM gui to spin up a VM from this image. When adding a new disk, you will select “Clone from image service” and add the image as a disk

Further Reading:

Read more about AOS Image Service

Read more about vDISK Management in AHV


0 replies

Be the first to reply!

Reply