qemu-img create with preallocation=full and compression_type=zlib

Daniel P. Berrangé
2021-11-30T14:27:32Z

On Tue, Nov 30, 2021 at 02:51:22PM +0100, Richard Taubo
wrote:
> Hi!
>
> When running this command on Fedora 35 I get:
> [#] qemu-img create -o preallocation=full -f qcow2
/var/vm_mail/mytest.qcow2 10GB
> => Formatting '/var/vm_mail//mytest.qcow2', fmt=qcow2 . . .
preallocation=full compression_type=zlib . . . ."
>
> Question:
> When using 'preallocation=full? I was surprised that the resulting
qcow2 image includes the 'compression_type=zlib? part.
> Why/when is this compression used when the qcow2 image is fully
preallocated?

It doesn't mean the image is currently compressed.

Rather it just records the desired compression algorithm for this image,
if any future writes were to be told to use compression.

Regards,
Daniel
--
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|