Re: [Libguestfs] compression method for qcow2?

Richard W.M. Jones
Thu, 13 Jul 2017 10:54:22 -0000

On Thu, Jul 13, 2017 at 05:04:07PM +0800, 陳培泓 wrote:
> I found guestfs_compress_out do the compression to gzip, bzip2,
> compress...etc.
>
> I want to compress qcow2, and I found details about qcow2 compression in
> https://people.gnome.org/~markmc/qcow-image-format.html
>
> The QCOW format supports compression by allowing each cluster to be
> independently compressed with zlib.
>
> Can I do that with guestfs_compress_out?

No, guestfs_compress_out is nothing to do with qcow2 compression.

The only way to create a qcow2 compressed filesystem is
‘qemu-img convert ... -c -O qcow2 ...’

The qcow2 format does not support incrementally writing compressed
clusters, and so it's not something which libguestfs can do unless
qemu's qcow2 block driver changes in future.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org