2 ms·
It's not quite as simple as that when you're dealing with pipelines. For example: cat /dev/zero | strace dd bs=1M of=/dev/null will show that you're not a
by koala_man 10y ago
It's not quite as simple as that when you're dealing with pipelines. For example:
cat /dev/zero | strace dd bs=1M of=/dev/null
will show that you're not actually writing 1M blocks. You're just reading whatever `cat` outputs (128KiB blocks on my system), so all you've done is an unnecessary pipe and copy. You would have been better off just redirecting.
Similarly,
dd if=/dev/zero bs=1M | strace gzip -1 > /dev/null
will show you that `gzip` will not start processing larger blocks. You're just adding an additional copy. Linux already has readahead, so I don't know if you'll ever see a benefit to this.
On my system, adding dd with higher block size on both sides of a gzip -1 pipeline just ends up being slower.
- takeda 10y agoThat's because bs means "up to" so if input comes at smaller blocks it will write in those. You should use obs, and preferably specify ibs to being multiple of obs.