# What block size to use when dd'ing a disk?



## fonz (Apr 4, 2012)

It is customary to prepare a to-be-encrypted disk with a command such as
`# dd if=/dev/random of=/dev/foo bs=bar`
Is there any rhyme or reason to choosing the block size for such a thing? Omitting bs=bar altogether is very inefficient, but setting it to 1 GB or something doesn't help much either. Is it possible to obtain a rough estimate of the optimum value from parameters such as the disk transfer speed, type of disk, etc.?

Fonz


----------



## Zare (Apr 4, 2012)

I also experiment block sizes with various storage devices to find optimal value. Wanted to have that answer too, and surprisingly, googling "dd optimal block size" yielded this as the first result;

http://forums.freebsd.org/showthread.php?t=11585

Not a definite answer but it provides a few tips / cases.
If you dig into this deeper, please keep posting. Thanks.


----------



## wblock@ (Apr 4, 2012)

Try it a few times, but most hardware doesn't benefit from buffer sizes larger than 64K or 128K.


----------



## fonz (Apr 4, 2012)

Zare said:
			
		

> surprisingly, googling "dd optimal block size" yielded this as the first result;
> 
> http://forums.freebsd.org/showthread.php?t=11585


I did a search on this forum, but how I managed to miss that thread is beyond me.

Anyway, apparently experimentation is the way to go. If I find anything I'll report back.

Fonz


----------



## wblock@ (Apr 4, 2012)

Some numbers here: http://forums.freebsd.org/showpost.php?p=115526&postcount=9


----------

