Migrate a VM from VirtualBox to libvirt

Posted on Mon 02 January 2017 in linux • 1 min read

Assuming you are using KVM as the libvirt backend:

  1. Find location of harddrive in filesystem

  2. Release and remove harddrive from VirtualBox (has not worked without this step)

  3. Convert to raw image with

    VBoxManage clonehd --format RAW vboximage.vdi rawimage.raw
    
  4. Convert to qcow2 image with

    qemu-img convert -f raw rawimage.raw -O qcow2 image.qcow2
    
  5. Copy image file as root to /data/libvirt/images (Adapt for your system)

  6. Create a new virtual machine with virt-manager and select the image.

  7. If it should be connected to physical network: Change Network source to shared device name and select br0

  8. Start machine, maybe it is necessary to update the device name in /etc/network/interfaces

References