Linux experts Seravo background Linux Debian SUSE
Linux-natives blog: Linux and open source – technology and strategy

Migrating from VirtualBox to Virt-Manager

The Linux virtualization module KVM is gaining a lot of popularity and system administrators everywhere are interested to learn about it.

As many Linux users run VirtualBox to host other OS’s under their primary OS, the easiest way to get experience about KVM is to replace VirtualBox with it and thus getting used to KVM.

Migrating from VirtualBox to KVM and Virt-Manager is actually quite easy, all you need to do is to convert the image file to the universal RAW format that KVM/qemu (and any other modern virtualization solution too) can read. Shut down all virtual machines and start converting the images with a command like:

$ VBoxManage clonehd --format RAW WindowsXP.vdi WindowsXP.raw
Clone hard disk created in format 'RAW'. UUID: cfe44508-d957-4c8c-b5c5-2b4f266830d8

The delay between 0% and 10% was 20 minutes on my machine, so be patient, even if it looks like nothing is happening. After you’ve converted all virtual images you can safely remove VirtualBox from you system completely with (assuming a Debian-based distribution) sudo apt-get purge virtualbox.

In most modern Linux distributions installing KVM can be done by simply running sudo apt-get install qemu-kvm virt-manager.

This installs KVM and the graphical front end Virt-Manager with accompanied dependencies like libvirt and qemu.

In case the installation does not start the backend automatically, you can also run manually sudo start qemu-kvm and sudo start libvirt-bin.

After that you can simply open virt-manager, choose to create a new virtual machine, and select the existing virtual machine image in raw format as the disk image.

From raw to qcow

Please note that raw consumes a lot of disk space. To have compressed disk images you could do a conversion like qemu-img convert -f raw WindowsXP.raw -O qcow2 WindowsXP.qcow
and possibly tweak the virtual machine settings.

Comparison to VirtualBox

VirtualBox is optimized for desktop usage, so it has a few advantages over virt-manager:

  • copy-paste works
  • resizing the resolution according to window size works
  • mostly 3D acceleration works

Virt-manager is however catching up as in the future the VNC communication will be replaced by Spice. Even with current VNC-based terminal KVM offers seamless mouse and focus tracking. KVM can also be used using SDL (the Simple Direct Layer media library) on a local display – this matches the typical VirtualBox use case.

Also note that the whole architecture behind Virt-Manager (kvm-qemu, libvirt) is designed primarly for server use which means for example that by default virtual machine images are saved in global folder /var/lib/libvirt/images and not under the users home folder as with VirtualBox. Also libvirt is implemented as a system service, virtual machines are easy to start up when the host system boots, while desktop users are likely want to start up virtual machines only when they want to use them, and most of the time desktop users don’t need the ability to run headless virtual machines, e.g. machines that run in the background but don’t have a GUI visible to the desktop user.

Virt-Manager/KVM has one big advantage over VirtualBox: speed. KVM is faster than VirtualBox on both CPU and I/O bound tasks.


Written by

Linux-natives – a blog by Linux experts from Finland – is brought to you by Seravo, a Finnish company focused on open source software and services.

Our team provides premium hosting and upkeep for your WordPress website - with open source software.

6 thoughts on “Migrating from VirtualBox to Virt-Manager

  1. Pingback: Visto nel Web – 48 « Ok, panico
  2. Pingback: Delicious Bookmarks for January 17th through January 18th « Lâmôlabs
  3. Hi-Angel says:

    The link about tweaking the newly converted image is broken ☹

  4. Otto Kekäläinen says:

    Hi-Angel: Thanks, the link is now removed as we are not aware of an identical site that could replace it.

  5. Pingback: » Linux -> Debian -> Migrating VMs from VirtualBox to KVM |
  6. Gustavo Adolfo Moennich says:

    Copy-paste works and resizing the resolution according to window size works under libvirt is available installing spice-vdagent in Linux and Windows guests.

Leave a Reply

Your email address will not be published.