[virt-tools-list] Enabling qcow2 compression with virt-install

Paul Maunders paul at fubra.com
Fri Aug 24 20:35:01 UTC 2012


>> Is it possible to enable qcow2 compression when using virt-install to
>> create a new image as part of a new virtual machine?
>>
>> I've searched the manual and online, but can't find any info on this.
>
> IIRC if you create the target disk yourself (using 'qemu-img create')
> and point virt-install at the disk (--disk path=foo.qcow2,format=qcow2)
> then it should work.
>
> Rich.

I gave it a go, but it doesn't look like the compression option is
supported with qemu-img create.

It is supported with qemu-img convert, so I tried creating an empty
image, then converting this to be a compressed image. However, when I
installed an OS on to this image no files were compressed.

I was able to get some compression working by installing a virtual
machine without compression using virt-install, stopping it, using
qemu convert -c ... to compress the image to a new image, then moving
the new image into the original location.

370M Aug 24 21:00 test-centos-compressed.img
1.3G Aug 24 20:17 test-centos-uncompressed.img

However, although the existing data was compressed, it seems that when
I started the vm, any new data appears to be stored uncompressed. I
tested this by downloading a large gzip'd wikipedia xml dump inside
the vm, and uncompressing it.

The file was 80MB compressed, 1.4GB uncompressed and once expanded it
added exactly 1.4GB to the underlying image, suggesting that the qcow2
image compression is no longer working.

1.8G Aug 24 21:00 test-centos-compressed.img

Is this expected behaviour?

I would have thought that once you enable compression it should apply
to all new files created within the image?

Regards,

Paul




More information about the virt-tools-list mailing list