Thursday, April 17, 2014
Text Size

Converting VirtualBox to Proxmox

There are many different virtualization products out there any while a lot of them are very good each one has its own place. Many years ago I started working with VirtualBox because it will run on anything. It provides very good performance when your system doesn't support hardware virtualization. It even worked well in the server market when you combined it with VboxTool and PHPVirtualbox. However it wasn't a enterprise solution and while it worked many of my customers were always looking at the shiny VMware products. This is where Proxmox comes into play. I have been watching the development of Proxmox since the 1.0 version. Now at 2.0 it is truly ready for testing. 

The vm's consist of XP pro and Vista64 and here are the steps that I took to get them into KVM

  1. Shutdown VM's
  2. Export Virtual Appliance
  3. Copy .OVA's to annother linux computer. This computer must have virtualbox installed.
  4. Extract the VMDK harddrive from archive
  5. Convert the VMDK harddrive to the .RAW format
  6. Convert the .RAW format to qcow2.
  7. Create the VM in Proxmox control panel.
  8. Move newly converted hard drive to replace the default one proxmox setup

The Open Virtualization Format (OVF) is an open standard for packaging and distributing virtual appliances for the use in virtual machines. An OVA file is a one file alternative to pack a multi file OVF directory. This is a short example how to convert OVA for the use in a proxmox 2.0 KVM environment. The OVA file was exported from the Virtualbox software, where we had build a debian based virtual machine.

Extract the OVA Archive

OVA files are TAR archives with the OVF directory inside. 
To extract the archive do

tar -xvf Virtual_Appliance_Debian.ova

You get Virtual_Appliance_Debian-disk.vmdk which is a virtual machine disk file. The VMDK file format was developed for the use in VMWare or Virtualbox. It is an open format.

Converting VMDK to RAW and from RAW to qcow2

With the free available software Virtualbox it is possible to convert VMDK disk files to RAW image format.

VBoxManage clonehd --format RAW Virtual_Appliance_Debian-disk.vmdk Virtual_Appliance_Debian-disk.raw
=> Virtual_Appliance_Debian-disk.raw

Convert the RAW image file to qemu format:

qemu-img convert -f raw Virtual_Appliance_Debian-disk.raw -O qcow2  Virtual_Appliance_Debian-disk.qcow2
=> Virtual_Appliance_Debian-disk.qcow2

Use qcow2 files in Proxmox 2.0

The use of an existing qcow2 file in proxmox 2.0 is very easy. Just create a new virtual machine and replace the disk file with the qcow2 file.

  • create a new KVM virtual machine via the proxmox webinterface.

    • Click Create VM.
    • General: select Node, VM ID and Name.
    • OS: Select the operating system type of your virtual machine.
    • CD/DVD: Do not use any media.
    • Hard Disk: Select existing lvm storage for storage and choose same or better bigger disk size as the original VM disk size.
    • other Tabs: as needed for the new virtual machine.
    • Confirm: Click Finish

Proxmox has created a new disk file for the virtual machine. Do not start the new VM. Replace the proxmox generated qcow2 file with our Virtual_Appliance_Debian-disk.qcow2

mv Virtual_Appliance_Debian-disk.qcow2 /var/lib/vz/images/105/vm-105-disk-1.qcow2


Category: Virtualization

I love you!

Emerald lace Midgett