Easily migrating existing VM from Virtualbox to KVM

How to migrate from Vbox to KVM smoothly and safely in under an hour

Problems

In my case, my hand was forced. I updated Debian from Buster to Bullseye and VirtualBox no longer worked. I run a Win7 guest for some client work. It usually works fine but there were a few issues with Vbox, meaning I didn’t mind using this excuse to migrate.

  • Resources - VirtualBox was quite a drag on my system.
  • Update cycle on Debian - Constant minor version update nags using the Oracle update source.
  • Guest additions/etc - Annoying process of updating these with every version of Vbox, always with the worry something new would break
  • Space (150GB vs qcow) - The VDI format lets you make a fixed disk, but qcow lets you shrink the unused space. My 150GB disk should be closer to a handful of GB.
  • Crashes when left on for extended periods - Never got the bottom of this one.

How to

  1. Convert from VDI to raw or qcow (I did RAW for compatibility in case there was an issue)

I had to do this without virtualbox’s tools given that it had stopped working (pro tip: use VBoxManage if you can):

VBoxManage clonehd --format RAW vm.vdi vm.img
  1. Install virtual-machine-manager
  2. Create a new VM, import, boot. Should work first time.

Shared folders are still an issue for me, I use a network drive atm, but that’s only available when VM is on.

If I can get back to how VB would mount a system directory within Windows, that would save a few copy-paste actions. Will get around to working that out! I’m not happy with the suggestions I’ve seen so far: SAMBA, SSHFS, NFS… Still working on getting “Filesystem Passthrough” working as Windows guests seem to be excluded.

Performance

It’s comparable. The screen refresh rate is lower, so I’m hoping to come across a solution to that. But in general resouce usage is down while it’s on. And it doesn’t crash when left on for days on end so initial tests show it to be more stable. At least for this aged Win7 guest.

In either case it’s nice to be on something more “native” to Linux and less at the whims of Oracle. Once the conversion to Qcow is done and the drive is shrunk, it should be nice and portable. Snapshots will be useful. All in all a relief it works so simply. Recommended!

Thanks for reading. I do translation from French and Swedish to English, so if that's useful to you, feel free to connect and message me on LinkedIn or Twitter.

Published by and tagged linux and productivity using 389 words.

Next:
Previous: