[kwlug-disc] [GTALUG] block size for dd -- no difference
Ron
ron at bclug.ca
Wed Sep 3 07:13:50 EDT 2025
William Park via Talk wrote on 2025-09-02 19:40:
> I was doing one of those occasional backup of my root SSD to HD. They
> are identical size, so sector by sector. I took this occasion to see if
> blocksize (bs=) matters.
>
> for i in {4,16,64,256}K {1,4,16,64}M; do
> echo ==== $i ====
> dd if=/dev/sda of=/dev/sdi bs=$i
> sync
> done
>
> No difference. All did 117MB/s.
Interesting.
My memory was that I've seen where block size makes a difference, so I
had to try for myself.
Don't have exactly the same setup so used /dev/random for input and a
file on a 5400RPM WD Red HD for output, changing the block size:
$ for i in 1 1000 1000000 10000000 100000000
echo "*** block size: $i"
rm ./dd-bs-test
dd if=/dev/random of=./dd-bs-test bs=$i count=(math "100000000
/ $i")
end
*** block size: 1
100000000 bytes (100 MB, 95 MiB) copied, 29.9448 s, 3.3 MB/s
*** block size: 1000
100000000 bytes (100 MB, 95 MiB) copied, 0.148444 s, 674 MB/s
*** block size: 1000000
100000000 bytes (100 MB, 95 MiB) copied, 0.112547 s, 889 MB/s
*** block size: 10000000
100000000 bytes (100 MB, 95 MiB) copied, 0.115528 s, 866 MB/s
*** block size: 100000000
100000000 bytes (100 MB, 95 MiB) copied, 0.132528 s, 755 MB/s
So, in this situation (perhaps a flawed test?), there's a dramatic
speedup going above bs=1, a significant speed improvement going above
bs=1000, and slight decreases in speed going above bs=1,000,000.
Similar results on an SSD, but *slower* on the low end and faster at
bs=1000000 (1M).
SSD results also slowly decline above bs=1M:
*** block size: 1
100000000 bytes (100 MB, 95 MiB) copied, 42.0427 s, 2.4 MB/s
*** block size: 1000
100000000 bytes (100 MB, 95 MiB) copied, 0.156072 s, 641 MB/s
*** block size: 1000000
100000000 bytes (100 MB, 95 MiB) copied, 0.10943 s, 914 MB/s
*** block size: 10000000
100000000 bytes (100 MB, 95 MiB) copied, 0.120185 s, 832 MB/s
*** block size: 100000000
100000000 bytes (100 MB, 95 MiB) copied, 0.133916 s, 747 MB/s
More information about the kwlug-disc
mailing list