Migrate Windows 7 KVM virtual machine to Virtualbox

Hi folks, here is me again posting tips about virtualization instead of database management stuff. I’m doing this specially to document stuff I had to deal with that I’m pretty sure I won’t be doing any time soon. This is one of such things, move a Windows 7 VM from KVM to Virtualbox… so let’s get to it, shall we?

First thing you might be interested to do is changing the type of hard drive used in KVM to IDE. If you have problems, check this out:
https://support.microsoft.com/en-us/kb/922976

The second thing is to convert the disk image from KVM to RAW using qemu.

# qemu-img convert -O raw Windows_7-KVM.qcow2 Windows_7VBOX.raw

Once the RAW disk is created, now it is necessary to convert it to VDI using VBoxManage.

# VBoxManage convertfromraw -format VDI Windows_7VBOX.raw /home/user/Windows_7VBOX.vdi
Converting from raw image file="Windows_7VBOX.raw" to file="/home/user/Windows_7VBOX.vdi"...
Creating dynamic image with size 85899345920 bytes (81920MB)...

Since I have been doing everything as root, I will now change the owner for the disk to my non-privileged user.

# chown user:group /home/brunomc/Windows_7VBOX.vdi

Finally we can create a VM on Virtualbox using the converted disk. Here is a brief overview:

Open up virtualbox and click on create virtual machine. Enter a name for the machine and click “Next”.
screenshot-create-virtual-machine

Select the amount of memory for the machine and click “Next”. In my example 3GB of RAM.
screenshot-create-virtual-machine-1

Now the most important part for this article, select the existing disk and locate your converted VDI.
screenshot-create-virtual-machine-2

Start the VM and check if it is working fine. Hope this helps 🙂

Advertisements

About Bruno Carvalho

Coffee addicted tech guy.
This entry was posted in Virtualization and tagged , , , , , , , , , . Bookmark the permalink.

2 Responses to Migrate Windows 7 KVM virtual machine to Virtualbox

  1. Nice step-by-step! I didn’t know that was necessary. I mean when you use vmware the disks are already in .vmdk format and VBox recognizes this disks, right?

    Best wishes,

    Franky

    • Thanks man! Honestly I’ve never tried to attach a vmdk directly from vmware to virtualbox, but I think if anything goes wrong it is possible to export the VM using ovftool and import into virtualbox.
      Best regards,
      Bruno Carvalho

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s