Re: Wheezy release: CDs are not big enough any more...
[Steve McIntyre]
> The major win with dd onto a raw device is that you can specify the
> block size. For most USB sticks, using a block size of 4MB or so is
> going to be *much* faster than using the default for dd (512 bytes)
> or cp (10 KB IIRC).
That seemed a little fishy to me, since none of the above commands do
any fsync by default, so I just benched it locally.
Writing a 50 MB businesscard image to a USB flash drive on my system
(numbers are MB/s):
dd bs=512 1.77 1.78 1.77
dd bs=1024 1.79 1.76 1.77
dd bs=2048 1.77 1.78 1.78
dd bs=4096 2.54 2.53 2.51
dd bs=8192 2.48 2.50 2.55
dd bs=4194304 2.50 2.50 2.54
cp 2.49 2.47 2.48
So it appears that if you aren't going to specify a bs= parameter here,
there's no point in using dd, unless you just happen to think its
command line syntax is particularly charming. And even if you do
specify bs=, you'll only barely beat cp.
For completeness, the same test writing a small file (1 MB),
unsurprisingly, is quite inconclusive:
dd bs=512 1.44 1.04 0.98
dd bs=1024 1.00 1.06 1.04
dd bs=2048 0.82 1.04 1.05
dd bs=4096 1.30 1.31 1.35
dd bs=8192 1.06 1.52 1.56
dd bs=4194304 1.19 1.28 1.27
cp 1.14 1.29 1.27
--
Peter
#!/bin/sh
infile=/tmp/debian-6.0.2.1-amd64-businesscard.iso
MB=$(stat -c'scale=2; %s/1048576' $infile | bc)
outfile=/dev/sdd
test_start () {
label=$1
sudo sysctl vm.drop_caches=1 > /dev/null # probably not really needed
t0=$(date +%s.%N)
}
test_end () {
sync
echo "$label : $(echo "scale=2; $MB / ($(date +'%s.%N') - $t0)" | bc) MB/s"
}
for n in $(seq 1 3); do
for sz in 512 1024 2048 4096 8192 $((1024*4096)); do
test_start bs=$sz
dd bs=$sz if=$infile of=$outfile 2> /dev/null
test_end
done
test_start cp
cp $infile $outfile
test_end
done
Reply to: