Skip to content

Optimize dd tool bs= option

cpx April 25, 2013 1 min read Tools

Correct dd BS=

0 # cat script.sh
#!/bin/bash
#
#create a file to work with
#
echo "creating a file to work with"
dd if=/dev/zero of=/var/tmp/infile count=1175000

for bs in  1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1M 2M 4M 8M

do
        echo "Testing block size  = $bs"
        dd if=/var/tmp/infile of=/var/tmp/outfile bs=$bs
        echo ""
done
rm /var/tmp/infile /var/tmp/outfile
creating a file to work with
1175000+0 records in
1175000+0 records out
601600000 bytes (602 MB) copied, 2.46301 s, 244 MB/s
Testing block size  = 1k
587500+0 records in
587500+0 records out
601600000 bytes (602 MB) copied, 4.01766 s, 150 MB/s

Testing block size  = 2k
293750+0 records in
293750+0 records out
601600000 bytes (602 MB) copied, 8.5141 s, 70.7 MB/s

Testing block size  = 4k
146875+0 records in
146875+0 records out
601600000 bytes (602 MB) copied, 5.99905 s, 100 MB/s

Testing block size  = 8k
73437+1 records in
73437+1 records out
601600000 bytes (602 MB) copied, 5.46301 s, 110 MB/s

Testing block size  = 16k
36718+1 records in
36718+1 records out
601600000 bytes (602 MB) copied, 5.9462 s, 101 MB/s

Testing block size  = 32k
18359+1 records in
18359+1 records out
601600000 bytes (602 MB) copied, 6.44593 s, 93.3 MB/s

Testing block size  = 64k
9179+1 records in
9179+1 records out
601600000 bytes (602 MB) copied, 6.03649 s, 99.7 MB/s

Testing block size  = 128k
4589+1 records in
4589+1 records out
601600000 bytes (602 MB) copied, 6.45788 s, 93.2 MB/s

Testing block size  = 256k
2294+1 records in
2294+1 records out
601600000 bytes (602 MB) copied, 6.39088 s, 94.1 MB/s

Testing block size  = 512k
1147+1 records in
1147+1 records out
601600000 bytes (602 MB) copied, 6.58437 s, 91.4 MB/s

Testing block size  = 1M
573+1 records in
573+1 records out
601600000 bytes (602 MB) copied, 6.77591 s, 88.8 MB/s

Testing block size  = 2M
286+1 records in
286+1 records out
601600000 bytes (602 MB) copied, 6.59395 s, 91.2 MB/s

Testing block size  = 4M
143+1 records in
143+1 records out
601600000 bytes (602 MB) copied, 6.61214 s, 91.0 MB/s

Testing block size  = 8M
71+1 records in
71+1 records out
601600000 bytes (602 MB) copied, 5.95964 s, 101 MB/s

 

 

0 0 votes
Article Rating
guest

0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x