Openstack converting between image formats raw, iso, vmdk
Source: http://docs.openstack.org/image-guide/content/ch_converting.html
Chapter 7. Converting between image formats
Converting images from one format to another is generally straightforward.
The qemu-img convert command can do conversion between multiple formats, including qcow2, QED, raw, VDI (VirtualBox), VHD (Hyper-V), and VMDK (VMware).
Image format | Argument to qemu-img |
---|---|
qcow2 (KVM, Xen) | qcow2 |
QED (KVM) | qed |
raw | raw |
VDI (VirtualBox) | vdi |
VHD (Hyper-V) | vpc |
VMDK (VMware) | vmdk |
This example will convert a raw image file named
centos7.img
to a qcow2 image file.$ qemu-img convert -f raw -O qcow2 centos7.img centos7.qcow2
Run the following command to convert a VMDK image file to a raw image file.
$ qemu-img convert -f vmdk -O raw centos7.vmdk centos7.img
Run the following command to convert a VMDK image file to a qcow2 image file.
$ qemu-img convert -f vmdk -O qcow2 centos7.vmdk centos7.qcow2
Note | |
---|---|
The -f flag is optional. If omitted, qemu-img will try to infer the image format.When converting an image file with Windows OS, ensure the virtio driver is installed. Otherwise, you will get a blue screen of death or BSOD when launching the image due to lack of the virtio driver. Another option is to set the image properties as below when you update the image in glance to avoid this issue, but it will reduce performance significantly. $ glance image-update --property hw_disk_bus='ide' image_id |
If you've 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 by default in the
~/VirtualBox VMs/
directory. The following example creates a raw image in the current directory from a VirtualBox VDI image.$ VBoxManage clonehd ~/VirtualBox\ VMs/fedora21.vdi fedora21.img --format raw