Converting a virtual machine with virt-v2v

Feb 18, 2020

This tutorial will show you how to convert a ESX machine to KVM using virt-v2v tool

Exporting the machine from ESXi

Click on Action -> Export, this will export an ovf file and vmdk file.

Creating an OVA file

Copy both files on the KVM server and create the OVA file from these two files.

# tar -cvf vm03.ova vm03.ovf disk-1.vmdk

Defining a KVM pool to store the ESX machines

# mkdir /kvm-pool/esx
# virsh pool-define-as ESX--type dir --target /kvm-pool/esx
# virsh pool-start ESX
# virsh pool-autostart ESX
# virsh pool-list

Installing virt-v2v on KVM server

# yum install virt-v2v

Converting and importing the ESX machine

[root@localhost]# virt-v2v -i ova vm03.ova -o libvirt -of qcow2 -os ESX
[   0.0] Opening the source -i ova vm03.ova
virt-v2v: warning: making OVA directory public readable to work around 
libvirt bug
[  66.7] Creating an overlay to protect the source from being modified
[  67.0] Opening the overlay
[  71.3] Inspecting the overlay
[  86.2] Checking for sufficient free disk space in the guest
[  86.2] Estimating space required on target for each disk
[  86.2] Converting CentOS release 6.10 (Final) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 140.6] Mapping filesystem data to avoid copying unused and blank areas
[ 141.0] Closing the overlay
[ 141.3] Assigning disks to buses
[ 141.3] Checking if the guest needs BIOS or UEFI to boot
[ 141.3] Initializing the target -o libvirt -os Esx
[ 141.3] Copying disk 1/1 to /kvm-pool/esx/vm03-sda (qcow2)
[ 319.2] Creating output metadata
Pool Esx refreshed

Domain vm03 defined from /tmp/v2vlibvirta2d6b9.xml

[ 319.3] Finishing off

Modifying network configuration

Edit the machine configuration and modify the “source bridge” line to br0

# virsh edit vm03
    <interface type='bridge'>
      <mac address='52:54:00:8d:b7:c3'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>

Starting the machine

# virsh start vm03

OS configuration

Using virt-manager log in on the server, comment the MAC address line in /etc/sysconfig/network-scripts/ifcfg-eth0, remove /etc/udev/rules.d/70-persistent-net.rules file and reboot.


Migrating DigitalOcean droplet to ESX or KVM

Booting from ISO file on KVM guest

comments powered by Disqus