[Nottingham] Very slow dd if=/dev/random

Dan Mackdermott nottingham at mailman.lug.org.uk
Tue Jul 29 09:47:01 2003


Hi Martin,

On Tue, 29 Jul 2003, Martin wrote:
> I've just wiped a partially corrupt hdd superblock and all's well.
> 
> Meanwhile, I tried:
> dd if=/dev/random of=/dev/hdg bs=1M
> 
> just for the sake of experimenting and...
> 
> it works, but incredibly slowly with one disk access every few minutes! 
> dd spends most of its time sleeping.

/dev/random will block until it has gathered enough entropy to give you 
some more randomness.  If it is on the same machine, try moving your mouse 
or using the keyboard to generate some more.

An experiment (under X) will demonstrate it.  Open an xterm and run 'od -c 
/dev/random'.  It should work for a few seconds and then stop.  Whilst 
it's stopped, moved the mouse or open another window.  It should start 
moving again.

If you don't want blocking to occurr for 'truer' randomness, try using the 
device '/dev/urandom'

> So why doesn't this work at 10's MBytes a second?

I think this is the reason...

Cheers,

Dan


-- 
Dan Mackdermott (Director)
InputLink Consulting Ltd
http://www.inputlink.net
t: +44 (0)115 988 1700
m: +44 (0)7980 711 557