Save space converting Qemu/KVM disk images to qcow2 format

Old versions of virt-manager used to create raw disk images, pre-allocated at creation: if you needed a 100Gb disk image, you would have a 100Gb file on your storage. This is good for performance, but terrible for provisioning, since you can’t overbook your disk space.

The new disk format, qcow2, use less space and provide more utilities (multiple snapshots, growing of disk image, encryption, compression, check qemu-img man page), so let’s convert all our old disk images to the new format:

$ for image in *.img; do qemu-img convert -O qcow2 "${image}" "${image}.qcow2"; done

Make sure to run a test with the new image before deleting the old one!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.