[lxc-users] lxc publish - how to use "pigz" (parallel gzip) for compression?

Tomasz Chmielewski mangoo at wpkg.org
Fri Sep 21 06:12:42 UTC 2018


"lxc publish $container --alias $container" can take quite long even on 
a server with multiple CPUs.

This is because "gzip" is used, which can only use one CPU, i.e.:

   gzip -c -n 
/var/snap/lxd/common/lxd/images/lxd_build_015181701/lxd_build_tar_202915839


Is it possible to specify an alternative compression program which is 
able to do parallel compression?

I see it doesn't work for pigz:

# lxc publish $container --alias $container --compression pigz
Error: exec: "pigz": executable file not found in $PATH


This is because it looks up the binary in /snap/core/4917/bin/ and pigz 
does not exist there.


xz is able to do parallel compression (i.e. xz -T 0), but sadly, lxd is 
not using it, so it's even slower than gzip:


# lxc publish $container --alias $container --compression xz


And this notation is not allowed:

# lxc publish $container --alias $container --compression "xz -T 0"


Are there any possible workarounds to use parallel compression for "lxc 
publish"?


Tomasz Chmielewski
https://lxadm.com


More information about the lxc-users mailing list