Converting a Xen Linux virtual machine to KVM

Updated -

The virt-v2v tool converts virtual machines from foreign hypervisors, including their disk images and metadata, for use with Red Hat Enterprise Linux KVM, Red Hat Enterprise Virtualization, and Red Hat Enterprise Linux OpenStack Platform.
This article provides instructions for converting and importing a Red Hat Enterprise Linux virtual machine from a Xen hypervisor to run on Red Hat Enterprise Linux 7 KVM and Red Hat Enterprise Linux 8 KVM.

For an overview of the virt-v2v tool, supported conversions, and links to other types of virtual machine conversions, see Converting Virtual Machines from Other Hypervisors to KVM with virt-v2v in RHEL 7 and RHEL 8.


Resource requirements

To convert a guest virtual machine with virt-v2v, your system must have at minimum:

  • Network bandwidth: minimum 1Gbps
  • Disk space: sufficient space to store the guest as a file, plus 1 GB
  • Sufficient free space in the guest filesystem according to the following table:
File system Minimum free space
Root file system 20 MB
/boot 50 MB
Every other mountable file system 10 MB


  • Install the virt-v2v packages and their dependencies:
# yum install virt-v2v
  • Configure password-less SSH access to the remote Xen host from the virt-v2v conversion server.
# ssh-agent 
SSH_AUTH_SOCK=/tmp/ssh-36jmUA3rn2JS/agent.24318; export SSH_AUTH_SOCK;
echo Agent pid 24319;
# SSH_AUTH_SOCK=/tmp/ssh-36jmUA3rn2JS/agent.24318; export SSH_AUTH_SOCK;
# SSH_AGENT_PID=24319; export SSH_AGENT_PID;
# echo Agent pid 24319;
Agent pid 24319
# ssh-add 
Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
  • Export the LIBGUESTFS_BACKEND=direct environment variable on the conversion server.
# export LIBGUESTFS_BACKEND=direct
  • Add your SSH public key to the /root/.ssh/authorized_keys file on the Xen host.
# ssh-copy-id
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh ''"
and check to make sure that only the key(s) you wanted were added.
  • To test the SSH configuration:
# ssh
Last login: Tue Nov  1 14:39:21 2016 from

The conversion server logs you in to the Xen host and does not request any password.


Ensure that the virtual machine is stopped prior to running the conversion process.


To convert a Xen Linux virtual machine:

# virt-v2v -ic 'xen+ssh://' rhelx-y /v2vconvert/

where x-y is the version of Red Hat Enterprise Linux running on the virtual machine being converted. For example, for Red Hat Enterprise Linux 5.1, use 5-1.

For a list of virt-v2v parameters, see the virt-v2v man page.

The following example shows the progress of virt-v2v converting a Red Hat Enterprise Linux 5 virtual machine running on a Xen host:

# virt-v2v -ic "xen+ssh://" -os default rhel5-para
[   0.0] Opening the source -i libvirt -ic xen+ssh://root@xen-sample-host. com rhel5-para
[   0.0] Creating an overlay to protect the source from being modified
[   0.0] Opening the overlay
[  69.0] Initializing the target -o libvirt -os default
[  69.0] Inspecting the overlay
[  80.0] Checking for sufficient free disk space in the guest
[  80.0] Estimating space required on target for each disk
[  80.0] Converting Red Hat Enterprise Linux Server release 5.11 to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 136.0] Mapping filesystem data to avoid copying unused and blank areas
[ 137.0] Closing the overlay
[ 137.0] Checking if the guest needs BIOS or UEFI to boot
[ 137.0] Copying disk 1/1 to /var/lib/libvirt/images/rhel5-para-sda (raw)
[ 599.0] Creating output metadata
Pool default refreshed

Domain rhel5-para defined from /tmp/v2vlibvirt8e77ed.xml

[ 599.0] Finishing off


On successful completion, virt-v2v creates a new libvirt domain XML file for the converted virtual machine with the same name as the original virtual machine. The virtual machine can be started using libvirt tools, such as virt-manager or virsh.

Confirm that the guest was imported correctly with the following command:

# virsh list --all

If this command lists the new Linux virtual machine, you have successfully converted and imported the guest. Boot the guest and confirm its full functionality before deleting the original guest or migrating active services.


  • virt-v2v saves converted virtual machines to the current user's namespace. However, libvirt maintains separate namespaces for the virtual machines for each user. As a result, if virt-v2v is run as a non-root user, virt-manager will not see the converted virtual machine.
  • It is currently not possible to convert guests from a Red Hat Enterprise Linux 5 Xen hypervisor, if the Xen server places the guests on block devices. (BZ# 1283588)

Further resources

For more information on managing virtual machines with libvirt in RHEL 7, see the Red Hat Enterprise Linux 7 Virtualization Deployment and Administration Guide.

For more information on managing virtual machines with libvirt in RHEL 8, see Configuring and Managing Virtualization.

For more information on using virt-v2v to convert virtual machines, see the virt-v2v man page and


Connecting to the Xen hypervisor over ssh requires the use of ssh keys (no password/key prompt) and the use of ssh-agent. This can be accomplished by running these commands from the conversion server:

# ssh-copy-id
# eval `ssh-agent`
# ssh-add 

Then run virt-v2v as described.