I use virtualization for various tasks. Either for running photo-editing software in Windows or just run a test CentOS in a safe environment. But for quite a while, for all of my virtualization chores, Virtualbox was the answer when you need something that works really quick. VM management is very easy and you could deploy a VM within seconds. Despite the fact that I use it flawlessly for years, I was tricked into migrating to QEMU. I thought that it is interesting to write down my experience.
The goal was to migrate my existing Windows 7 VM to a QEMU, without compromises in usability and without (extensively) modifying the image. Moreover I wanted to tackle with some KVM features (like memory ballooning). For some people it seems more reasonable to perform a clean Windows installation, rather to struggle migrating an existing one. I chose the hard way, because of fun primarily and I didn't want to reinstall programs from scratch, customize it etc.
Before migrating, make sure you have the required packages for QEMU and
The first step for the migration is to convert the Virtualbox VDI image into raw format. This can be performed using the following command:
As the disk image is cloned, the free space in your disk should be at least
the size of the VM. Let's say the image is 30 GB, you will need at least 30 GB
of free space in order the conversion to be successful. Furthermore, cloning
takes a considerable amount of time, so be patient.
Upon successful conversion, I tried to run the image with QEMU and no special arguments.
The -m 1024 specifies the amount of memory that the VM should have. The result in my case was a BSOD!
Let's try to run it with KVM support
Here, the VM started successfully, despite the fact that it was a bit slow. Hence, I download the VirtIO drivers ISO and mount it in the VM. Let's start the VM again with virtio network and virtio disk to see what happens.
This resulted in a BSOD again, as the VirtIO disk driver was not actually installed. The solution was found in Archlinux wiki. You need to make a "dumb" image and boot the VM with that.
As stated in the Archlinux wiki, Windows will detect the dumb image as a new device and will try to find a driver. Go to Control Panel > Device Management, detect the "Unknown device" and Install the VirtIO SCSI driver from the virtio-win iso. Then shutdown the VM, and boot it with virtio support: Works flawlessly!
Another feature I would like to tackle with, was memory
ballooning. In short, you can change the VM memory on the fly, without
rebooting it. More information for this feature is available on the linux-kvm.org page.
When run, the Windows VM, will detect the balloon device and will install the respective driver.
You can change the memory size from the QEMU monitor (press Ctrl+Alt+2) using the command "balloon". Then run "info balloon" to list its current status.
Hope this information will help you perform a migration from Virtualbox to QEMU/KVM without a hassle!