Grant McWilliams

Tech Virtualization

Virtualization

 

To convert a QEMU qcow format disk to VirtualBox vdi format you need to have Qemu installed. Qemu has tools to help convert disk formats.

grant@workstation:~$ qemu-img convert hda-qcow.img -O raw hda.img
grant@workstation:~$ VBoxManage convertdd hda.img hda.vdi
VirtualBox Command Line Management Interface Version 1.6.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Converting VDI: from DD image file="hda.img" to file="hda.vdi"...
Creating fixed image with size 1024966656 bytes (978MB)...


This will convert a QEMU qcow format disk image to VirtualBox vdi format.

 

 

Add a comment

The problem with Virtualization systems is none of them want to standardize on one particular disk format. Actually they all do, they want their format to be the standard.

  • VMware has VMDK
  • QEMU has qcow and qcow2
  • UML has cow
  • Parallels has HDD
  • VirtualPC uses VHD
  • VirtualBox has VDI
  • Xen uses raw disk images

To make matters more confusing VirtualBox has some support for VMDK, Commercial Xen supports VHD, the open source Xen supports qcow2 and Qemu can convert between many formats. So what I'm doing about this is putting up a series of Howtos in the Tech -> Virtualization areas on how to convert and use various disk formats in different Virtualization systems. To start with I just put together the following two Howtos.

Add a comment

When Intel and AMD added hardware virtualization support to their CPUs it was a boon to those of us trying to virtualize Operating Systems that don't know they're being virtualized. KVM the somewhat native Linux virtualizer built into the kernel only operates in this mode so you need a CPU with Intel VT-x or AMD-V support built into it and the ability to turn it on in the BIOS. This seems like a really great thing but in reality anyone wanting to extract the maximum performance out of their Virtualization machine is going to be using paravirtualization anyway (sorry KVM). Everyone is working on paravirtuaization including the KVM folks. So the addition to VT extensions in the CPU are really not getting used much besides those that don't have a choice (ahem, KVM). A year from now people using KVM will be using paravirtualized drivers because they're just plain faster. VirtualBox uses a mix of software emulation and virtualization depending on what's fastest. Xen will run in both Full Virtualization (HVM) or paravirtualization (PV) modes depending on how you set it up. There are limitations to PV mode though becuase it's using the same QEMU code that KVM uses. They will reach parity in installation modes between PV and HVM soon though. The cool thing about everyone using QEMU (KVM, Xen, VirtualBox etc..) is that if you change the code once the rest get the updates. Isn't that the way it's supposed to work in the Open Source world?

Anyway the point of this article is not to talk about VT but IOMMU. The problem with Virtualization systems like Parallels and Xen are that they're passing PCI devices through to guest operating systems which is a good thing but because they haven't had support in the CPUs it's been a bit hacked up. There's been a number of security vulnerabilities with pci passthrough in Xen. All of this is changing because Intel and AMD are adding device virtualization to their kernels. Intel announced it in 2006 and has a number of chipsets that support it and AMD will have their first out next year.

Add a comment

If you're moving from a real server installation to a VirtualBox virtualized configuration you may want to take your real physical disk and just turn it into a virtual disk. There are advantages to creating a new disk and rsyncing your OS into it but this tutorial will show you how to make an exact copy of it. Note the exact copy will be the same size as the real physical disk so make sure you have enough drive space. This is most useful for Operating System images with shared storage for data. I wouldn't advise anyone to make a 1TB copy of their new drive and turn it into a VDI file!

To get the image from the disk use the dd command.

  1. dd if=/dev/hda of=./hda.img
  2. VBoxManage convertdd hda.img hda.vdi
grant@workstation:~$ dd if=/dev/hda of=./hda.img
grant@workstation:~$ VBoxManage convertdd hda.img hda.vdi
VirtualBox Command Line Management Interface Version 1.6.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Converting VDI: from DD image file="hda.img" to file="hda.vdi"...
Creating fixed image with size 1024966656 bytes (978MB)...

This will make an exact copy of /dev/hda to the raw image file hda.img. Then VBoxManage will convert the raw disk hda.img to hda.vdi for use with VirtualBox.

Add a comment
Tech Virtualization