bash 如何将 Pigz 与 Tar 一起使用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36917882/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use Pigz with Tar
提问by Cam
So I am using pigz in tar with
所以我在 tar 中使用 pigz
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).
这有效,但它没有使用我的所有处理器,我想确保它是递归的(-r)并使用(-9 压缩级别)。
I read through Utilizing multi core for tar+gzip/bzip compression/decompressionbut 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.
我通读了使用多核进行 tar+gzip/bzip 压缩/解压缩,但它没有在任何地方添加该格式的附加命令,而且我在手册页中找不到任何程序的任何内容以进行附加切换。
Thanks, Cam
谢谢,卡姆
回答by Amit.Sinha
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:
马克·阿德勒 (Mark Adler) 在问题中包含的 SO 链接上的最高投票答案确实提供了用于指定压缩级别以及要使用的处理器数量的解决方案:
tar cf - paths-to-archive | pigz -9 -p 32 > archive.tar.gz
回答by Stefan Lasiewski
To pass arguments to pigz
using -I
or --use-compress-program
, you can enclose the command and arguments in quotes, like so:
要将参数传递给pigz
using-I
或--use-compress-program
,您可以将命令和参数括在引号中,如下所示:
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
回答by Nick Kutuzov
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