In my previous blogpost I showed you how easy it is to migrate a physical Windows machine to Nutanix AHV (Link). I got a couple of questions about Linux 😉 Now lets do the same again but with a Linux machine. I got myself a freshly install Ubuntu desktop as shown in the screenshot:

On this machine I have 2 disks. A 500GB Samsung SSD and a 1TB SSD. The 1TB SSD is the boot / OS disk and is being used in my case. The 500GB SSD is not being used and doesnt have any partition on it.

On the screenshot below you can see the disk being used is /dev/sda and has the following partitions:
- sda1 : efi boot partition
- sda2 : root partition

In my case I need to create an image from the /dev/sda disk (including the sda1 and sda2 partitions). I use the “qemu-img” tool for this. You can use dd as well but then you have to convert the raw image to qcow2 later. Using qemu-img will let you directly create the qcow2 image. If qemu-img is not available you can install it with: sudo apt install qemu-utils

To create an image of the complete disk with qemu-img type: “sudo qemu-img convert -c -S 4K -p -O qcow2 /dev/sda ~/Linux_Desktop.qcow2”. Yes, I’m putting the image file on the same partition from where I’m creating an image of. This will work 😉

When the image is created upload it to your Nutanix cluster.

When the image is uploaded create a virtual machine from it. Make sure you create a machine with the same BIOS/UEFI settings as the original machine. In my case it is a UEFI machine. Create the virtual hard disk from the uploaded image and boot the virtual machine. And there you go P2V Linux:

If the virtual machine doesn’t boot check if the VirtIO drivers are present by running: grep -i virtio /boot/config-`uname -r`

VirtIO drivers for Linux are not available for download as they should be already present in the OS. If they are not present, try installing the Nutanix guest tools on the machine and try the process again.
For certain workloads it is better to use a bootdisk (bootable usb stick, live cd) and run the image creation from there (to bypass modifications to the disk while creating the image). But that requires an extra disk to place the image.