I had a need that required me to completely wipe my Intel NUC running Nutanix Community Edition (CE), including all VMs. Unfortunately, a couple of those VMs have become pets, not cattle so I had to find a way to backup and restore those VMs. Poking around online I found various parts of what I wanted to do most of which centered around backing up the VMs or exporting them to another hypervisor. I couldn’t find anything on completing the process of actually restoring the VMs that were backed up. So I set out to finish the loop.

First, a few notes:

  • I will attempt to keep this guide mid-level. Feel free to ask questions in the comments.
  • Remember, Nutanix CE only has unofficial/forum support and this guide does not change that fact.
  • The process documented here is very manual, even though it would be best to automate all of this via scripting/REST/etc. I’ll try to come back to that later.
  • The purpose of this guide is to backup and restore a VM on AHV, such as CE running on a NUC as a single node cluster. There are no instructions here for backing up anything else related to the CE environment, such as schedules, cluster settings, AFS, ABS, etc. – JUST the VMs.
  • This is Linux based, meaning I use a Linux server to work from and as my backup server. This could also be done in Windows using WinSCP, ssh, etc. Adjust as necessary!
  • I’m going to safely assume that for the backup and restore you will be working from the same Linux server.
  • I strongly advise you first try this on a generic VM you do not care about to make sure you are successfully able to backup/restore a VM. You can do this without destroying the cluster to test the backup/restore procedures. Once you know the method works, then you can backup your vital VMs, destroy/recreate your CE, and then restore your vital VMs.
  • caveat emptor

Variables used:

  • vmName = The name of the VM with which you are currently working.
  • containerName = The name of the container (default or otherwise) that houses the vmName’s virtual disks.
  • cvmIP = the IP of your CVM.
  • linuxHost = the IP or hostname of the Linux server which you will be using as your backup server.
  • userName = the username of your user on the Linux host

Variables will be surrounded by curly braces {} in code below. You will not need the curly braces when you type in the commands yourself.


  • You must whitelist the IP of the Linux host in the advanced settings of the storage container(s) with which you are working.
  • Your storage container must have enough space to store a thin provisioned copy of the VM that you are backing up. In one of my tests, a Windows 10 VM which was using 14.84GB of 64GB provisioned was only 7.7GB when backed up. YMMV.
  • Power off the VM prior to backing it up.
  • Delete all snapshots (meaning delete them, or restore to & then delete them). I have not yet tested or tried this on a VM with snapshots.
  • linuxHost must have nfs client tools installed (nfs-common)

There may be variables in your environment that I do not account for in this documentation.

Backing Up a VM:

From your CVM:

  1. ssh into your CVM and log in as nutanix.
  2. Start a screen session:

    You will want to do this as step 7 could take awhile and your ssh session might time out. If you get disconnected you can ssh back in and resume where you left off by using:

  3. Get the details of your VM:

    Make a note of the vmdisk_uuid. If you do not know the name of the container on which your VM stores its virtual disk then also make a note of the container_uuid.
  4. Dump the VM details to a file so we can use them during the restore:
  5. Use scp to copy that file to your backup target:
  6. If you don’t know the name of the container that contains the VM’s disks get it using ncli:

    Use the output to get the Name of the container with the container_uuid from step 3. As noted earlier I will use the variable containerName for this value. If you used the defaults when setting up CE, it will be something like default-container-1234567890123.
  7. Using the containerName & the vmdisk_uuid, convert the VM’s virtual disk to a qcow2 image:
  8. From your Linux server:

  9. Create a directory where you will mount the NFS share:
  10. Mount the CVM NFS share:
  11. Create a local directory to which you will copy the vdisks:
  12. Create another directory for the VM you are working with (This is optional, but might help keep things organized if you are backing up several VMs):
  13. Copy the qcow2 file from the NFS share to your local directory:
  14. Move the vm file you created in step 4 and copied over in step 5 into the same directory with the qcow2 file:

The directory ~/vmbackups/{vmName} should now have a .vm and a .qcow2 file. At this point the VM (info) and its virtual disk are backed up. After all your pet VMs are backed up you can blow away your CE environment, set it up again, then follow the rest of the steps to restore.

When you reinstall CE, any default container name(s) will likely change so keep that in mind prior to restoring your VMs and adjust accordingly. Don’t forget to whitelist the linuxHost again!

Restoring a VM:

From your Linux server:

  1. Mount the CVM NFS share again:
  2. Copy the qcow2 file back to the NFS share:
  3. From your CVM (ssh in as nutanix, use screen):

  4. Create an Image Configuration using the qcow2 file as the source with the name {vmName}-image:
  5. Create a VM with the same Name/CPU/Memory config as before (refer back to the {vmName}.vm file you created for any details). In this example the VM has 1 vCPU with 2 cores per vCPU (a single socket with a dual core CPU) and 2GB of RAM. Adjust as needed:
  6. Create a virtual disk for the VM using the Image you just created in step ##:
  7. If you need a cdrom add it:
  8. Add a NIC to the VM with the same MAC Address attached to the same Network (0 in this example) as the previous VM (refer to the {vmName}.vm backup file for the mac_addr and network_name):

    If you do not care to use the prior mac address you can leave off the mac=mac_addr portion. The network will need to be a valid network ID. In this case mine is network 0. You can get a list of valid networks by using the command
  9. At this point you should be good to power on your VM and verify it functions as expected. I tested both Windows 10 and Ubuntu Server 16.04 and had no issues with restoring them. If you’re using DHCP you might still get a different IP address even if you use the same MAC address if you aren’t using reservations and enough time has passed that the DHCP lease expires. Other than that, you should be good to go.

    Clean up

    After restoring the VM and verifying functionality you will want to clean up 2 items on the container. Those are the qcow2 file and the {vmName}-image (unless you have plans to reuse that image file, in which case I’ll assume you know what you’re doing).

    From your Linux server:

    • Mount the CVM NFS share if not already mounted, then delete the qcow2 file from the NFS share:

    From your CVM (ssh in as nutanix):

    • Delete the image:

      For some reason you have to actually answer yes/no, so answer yes unless you somehow mashed on the keyboard to perfectly type out that exact command. In which case answer no and go buy a lottery ticket! I get half. Half.