gzip - redirection or piping?

You don't need to use dd or piping at all.

</dev/sda gzip >/mnt/sdb1/backups/disk.img.gz
</mnt/sdb1/backups/disk.img.gz gunzip >/dev/sda

I once made a benchmark and found using dd slower than cat for a straight copy between different disks. I would expect the pipe to make any solution involving dd even slower in this case.


Piping involves one more process and one more user-land copy, so it should be more efficient to use redirection.

But I guess that on nowadays hardware & software caching system, it should not make any real difference. Maybe you can have better results using bs=4k or bs=64k, since it's the pipe's limit under linux. See this question for more detail about different bs parameters.

Tags:

Linux

Pipe

Gzip

Dd