optimal block size, cloning with dd

193 views
Skip to first unread message

Robert Citek

unread,
Apr 9, 2007, 4:23:28 PM4/9/07
to Central West End Linux Users Group
Hello all,

Is there any way to know the optimal block size for transferring data to
a disk without doing some empirical tests?

Apparently, when cloning a disk with dd, the block size seems to have a
significant effect on data transfer rate. In the tests below, I
decreased the block size and increased the number of blocks to hold the
total number of bytes transferred constant while cloning a Kubuntu image
for ByteWorks:

$ time -p dd if=kubuntu.img of=/dev/sdb1 bs=8k count=50000
50000+0 records in
50000+0 records out
409600000 bytes (410 MB) copied, 20.9012 seconds, 19.6 MB/s
real 21.16
user 0.02
sys 1.36

$ time -p dd if=kubuntu.img of=/dev/sdb1 bs=4k count=100000
100000+0 records in
100000+0 records out
409600000 bytes (410 MB) copied, 20.4719 seconds, 20.0 MB/s
real 20.48
user 0.05
sys 1.62

$ time -p dd if=kubuntu.img of=/dev/sdb1 bs=2k count=200000
200000+0 records in
200000+0 records out
409600000 bytes (410 MB) copied, 91.5883 seconds, 4.5 MB/s
real 91.71
user 0.13
sys 3.34

$ time -p dd if=kubuntu.img of=/dev/sdb1 bs=1k count=400000
400000+0 records in
400000+0 records out
409600000 bytes (410 MB) copied, 89.4825 seconds, 4.6 MB/s
real 89.78
user 0.16
sys 4.18

$ time -p dd if=kubuntu.img of=/dev/sdb1 bs=512 count=800000
800000+0 records in
800000+0 records out
409600000 bytes (410 MB) copied, 97.2643 seconds, 4.2 MB/s
real 97.57
user 0.47
sys 7.12

512 bytes is the default block size if none is specified. Notice that
there is almost a five fold gain by specifying a block size of 4 kB
versus using the default of 512 bytes. Although not shown above, block
sizes of 16k, 32k, 64k, and 128k all gave similar results as 4k.

Regards,
- Robert

tms

unread,
Feb 26, 2008, 1:41:55 PM2/26/08
to cwe...@googlegroups.com
Robert, a while back you were looking for a quick, easy way to convert a
bunch of image files from one format to another, weren't you?

I've been playing around with wine, and installed irfanview, just to see
how it would do. Quite nicely, is the answer, except its convert
to .pdf seems to fall over and die after the first file. I'll keep
looking into that.

But for anything else, you can quickly convert, with a lot of options --
resize, rename, change formats, overwrite, save in a different
directory, etc.

So, not a command line option at all, but if you have a user who prefers
a GUI solution, this is a quick one. It also has a nice "thumbnail"
feature for quickly viewing lots of images.

I even found an Ubuntu-specific page for installing IrfanView at
https://help.ubuntu.com/community/Wine/IrfanView

Not Open Source, but then if it were, it wouldn't have to run in wine,
most likely.

Theresa

Reply all
Reply to author
Forward
0 new messages