This question came from our site for professional and enthusiast programmers.

2

I would try to backup file systems, not raw disk images. And to tune the parameters, you'll have to benchmark.
–
Basile StarynkevitchMar 12 '12 at 6:20

dd is archaic (any other tool thankfully does away with bs= and count=, like ddrescue), and in your case also pretty much pointless. Just pipe it into gzip -c </dev/sda >disk.img.gz & gzip -cd disk.img.gz >/dev/sda.
–
jørgensenMar 12 '12 at 11:12

Or do it with rsync. Just construct the command with the parameters, and it will do you everything in the most efficient way it thinks.
–
vakufoMar 12 '12 at 11:53

In the second command of the second listing, what is the dd if=.../disk.img.gz | part supposed to do? As far as I understand, gzip -dc (=zcat) doesn't care for its stdin when there's a file argument.
–
sr_Mar 12 '12 at 13:57

2 Answers
2

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.