qemu-img is a QEMU disk image utility, which allows us to create, convert and modify images offline. It can handle all image formats supported by QEMU (including qcow2 and raw image format).
Installing qemu-img:
[root@tuxfixer ~]# yum install qemu-img
Converting qcow2 image to raw image format using qemu-img:
[root@tuxfixer ~]# qemu-img convert -f qcow2 -O raw image.qcow2 image.img
Converting raw image to qcow2 image format using qemu-img:
[root@tuxfixer ~]# qemu-img convert -f raw -O qcow2 image.img image.qcow2
if, the original (raw) image is static a one with a lot of unused space inside … is there any option one could add to to the `qemu-img convert` command to get a dynamic .qcow2 (which should be significantly smaller then) on the other side?
you can always shrink qcow2 image, after converting it, using these commands:
http://www.tuxfixer.com/how-to-shrink-openstack-qcow2-image-with-qemu-img/
and that’s what I usually do after converting image to qcow2.
How can we convert the .qcow2 img file to .img fle
Thanks – worked for me 🙂