Converting Between Image Formats

Metacloud supports the following formats and the corresponding command arguments for use in the CLI.

Image Format Command Argument
QCOW2 (KVM, Xen) qcow2
QED (KVM) qed
raw raw
VDI (VirtualBox) vdi
VHD (Hyper-V) vpc
VMDK (VMware) vmdk

Note
If you use Ceph as your image repository storage (glance), QCOW2 images are no longer supported. You need to convert QCOW2 images to the RAW image file format. For a complete list of supported images per storage type, see Working with Images.

To convert from one image format to another, use the QEMU disk image utility:

$ qemu-img convert -f <OLD_FORMAT> -O <NEW_FORMAT> <OLD_IMAGE> <NEW_IMAGE>

The -f <OLD_FORMAT> flag is optional. When omitted, qemu-img attempts to infer the image format.

Note

  • When converting an image file with Windows, the VirtIO driver must be installed. If it is not installed, you will see a blue screen when launching the image.
  • An alternative to installing VirtIO is to set the image properties as shown below when you update the image in the Image service; however, this method reduces virtual machine performance significantly.
$ openstack image set --property hw_disk_bus='ide' > image_name_or_id

Example 1: Converting Raw image file to qcow2 image file

$ qemu-img convert -f raw -O qcow2 image.img image.qcow2

Example 2: Converting VMDK image file to raw image file

$ qemu-img convert -f vmdk -O raw image.vmdk image.img

Example 3: Converting VMDK image file to qcow2 image file

$ qemu-img convert -f vmdk -O qcow2 image.vmdk image.qcow2

Example 4: Converting VDI (VirtualBox) to raw

If you created a VDI image using VirtualBox, you can convert it to raw format using the VBoxManage command-line tool that ships with VirtualBox. On Mac OS X and Linux, VirtualBox stores images in the ~/VirtualBox VMs/ directory.

$ VBoxManage clonehd ~/VirtualBox\ VMs/image.vdi image.img --format raw