Need faster urandom on Ubuntu?


While burn-in testing my new USB 3.0 ZFS RAID array on Ubuntu 12.04.1 I wanted to fill disks with random data. Not zeroes from /dev/zero, but random data to catch any flakey disks or USB cables. Well it quickly turned out that reading from urandom was slowing process down a lot. Since quality of randomness doesn't matter much in this case frandom was easy solution.



Using five 3TB USB 3.0 disks configured as ZFS RAIDZ-1 I'm getting solid 190MB/s write speed. Could be much better, but not bad for 600 euros worth of disks and USB PCI-e controllers either.

# Download frandom
mkdir -p /opt/src/frandom
cd /opt/src/frandom
wget http://dump.asiantuntijakaveri.fi/le_bueno_dumpo/frandom-1.1.tar.gz
# or
# wget http://billauer.co.il/download/frandom-1.1.tar.gz

# Unpack and compile
tar xvzf frandom-1.1.tar.gz
cd frandom-1.1
make

# Install
install -m 644 frandom.ko /lib/modules/`uname -r`/kernel/drivers/char/
depmod -a

# Load
modprobe frandom

# Test urandom for baseline
dd if=/dev/urandom of=/dev/null bs=4k count=100000
100000+0 records in
100000+0 records out
409600000 bytes (410 MB) copied, 27.6681 s, 14.8 MB/s

# Results from frandom are FAST
dd if=/dev/frandom of=/dev/null bs=4k count=100000 
100000+0 records in
100000+0 records out
409600000 bytes (410 MB) copied, 1.47316 s, 278 MB/s


Comments