Convert XVA Virtual Machine to VMDK

This book will cover how to convert a VM exported from Xen Orchestra in XVA format to a VMDK.

Preparing Your Machine

XVA-Desktop.png

1. Installing XVA-img

These are the instructions on how to install the XVA-img tool which is updated and patched for checksum and xxhash

1. Installing XVA-img

1.1 Installing xva-img from source

Objective: Install xve-image from source on an ubuntu 20.04 LTS machine in order to convert from XVA to a VMDK to be imported in VMWorkstation

Step 1. Navigate to eriklax/xva-img: XVA (Citrix Xen format) virtual disk tool. Supports RAW disk image exports and imports. (github.com) and download the entire zip file of the repository. In this situation, I am using wget on the Linux machine to download in my current directory.
Step 2. From terminal, unzip everything to whatever directory you want. I chose '/opt'
change directory to where the zip file is located. 
cd /opt/xva-img
Unzip the Master zip file you just downloaded from git
unzip master.zip
Step 3. Change directory into the unzipped directory of 'xva-img-master'
Step 4. Install the dependencies for xva-img as noted on the github page, and install from source

This is the final step installing xva-img on to your machine.


2. Extracting the XVA to Raw Disk

In this Chapter, I will cover how to use xva-img to extract the disk from the XVA file to a raw disk which will later be converted to a VMDK

2. Extracting the XVA to Raw Disk

2.1 Extract the XVA File to Raw Disk

Objective: Extract the disk from the from the XVA to a raw disk to be converted to VMDK.

Step 1. Navigate to a location that you would like to work from. In my scenario, I am working from my user's home directory in a folder name 'XVA VMs'
Belows is a screenshot of my working directory

xva-working-dir.png

Step 2. Once inside the working directory, run the following commands as root

Step 3. Next we are going to export the Disk  by utilizing disk-export command

xva-img -p disk-export my-virtual-machine/Ref\:4/ disk.raw

The Ref: number may vary. The way to get the correct number is to run the ls command against the "my-virtual-machine directory where the ova.xml and disk files are located. Reference the below screenshot.
my-virtual-machin-contents.png

Extraction Process Complete
It will take a little bit of time to extract, but the -p command when exporting will show you the current progress. Once it completes, you will have a 'disk.raw' file unless you decide to name it 'somethingelse.raw'

This completes the extraction of the disk from the XVA file. You can now examine the disk raw or convert it to any other format such as qcow2 or vmdk.

3. Convert disk.raw to VMDK

This chapter will discuss how to take the extracted raw disk from the XVA file and convert it to a vmdk

3. Convert disk.raw to VMDK

3.1 Convert the disk.raw file to a VMDK

Objective: Use qemu-img to convert the raw disk extracted from the XVA file in our working directory to a vmdk file for the ability to import in VMWare.

Step 1. Navigate to a location that you would like to work from. In my scenario, I am working from my user's home directory in a folder name 'XVA VMs'
Belows is a screenshot of my working directory

xva-working-dir.png


Step 2. Before you run the command, you need to ensure that you install qemu-utils. Once you ensured that qemu-utils is installed, you need to run the following command below:
qemu-img convert -f raw -O vmdk disk.raw satire-wordpress.vmdk
You can name the vmdk whatever you like, this is just specific to my scenario
That is all there is to it. Just let this process run and you will have usable VMDK that can now utilize in VMWare products.