How to use Pigz with Tar

狂风中的少年 提交于 2020-03-17 04:29:11

问题


So I am using pigz in tar with

tar --use-compress-program=pigz

and this works but it doesn't use all of my processors, and I'd like to make sure it's recursive (-r) and using (-9 compression level).

I read through Utilizing multi core for tar+gzip/bzip compression/decompression but it doesn't note anywhere to add additional commands in that format, and I couldn't find anything in the man page for either program for additional swithed.

Thanks, Cam


回答1:


Mark Adler's top voted answer on the SO link that you included in your question does provide a solution for specifying compression-level as well as number of processors to use:

tar cf - paths-to-archive | pigz -9 -p 32 > archive.tar.gz

See : https://stackoverflow.com/a/12320421




回答2:


To pass arguments to pigz using -I or --use-compress-program, you can enclose the command and arguments in quotes, like so:

tar --use-compress-program="pigz --best --recursive" -cf archive.tar.gz YourData

Here's a fun option to monitor the speed of the archive creation:

tar --use-compress-program="pigz --best --recursive | pv" -cf archive.tar.gz YourData



回答3:


fast unpack:

tar -I pigz -xf /mnt/sd/current/backup/bigbackup_web.tar.gz -C /tmp

fast pack:

tar -cf bigbackup.tar.gz -I pigz /opt

then:

apt-get install pigz

or

yum install pigz


来源:https://stackoverflow.com/questions/36917882/how-to-use-pigz-with-tar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!