Press "Enter" to skip to content

Posts published in “Raspberry Pi”

Raspberry Pi disk access speeds

Okay so I have accumulated 3 Raspberry Pi’s to date.  And yes I truly enjoy them.  Great little boards that can actually do amazing things on < 5w @ 5VDC.  2 of the 512M and 1 256M of the version.

But are they suitable for some needs?  Perhaps not.

I’m going to run through a series of benchmarks and publish my results and take from them what you well.

First up disk write speeds –
using a simple dd command I’ve time’d the writing speed for a 164M file and sync’d it using this command
#time sh -c “dd if=/dev/zero of=./ddfile bs=8k count=20000 && sync”

This writes a 164M file filled with zero’s and flushes the IO buffer to the filesystem and measures the amount of time to complete the process as well as a throughput rate.

  • Test #1 – 512M Pi writing to a USB thumbdrive (Note this Pi boots from a 256M SD Card and the root filesystem lives on a 16G Sandisk Cruzer plugged directly into the Pi)

Results:
# time sh -c “dd if=/dev/zero of=./ddfile bs=8k count=20000 && sync”
20000+0 records in
20000+0 records out
163840000 bytes (164 MB) copied, 35.5217 s, 4.6 MB/s

real 0m53.487s
user 0m0.200s
sys 0m2.420s

  • Test #2  – 512M Pi writing to a Class 10 64G SD Card (SDC Brand SD XC)(boot and root file systems live on this card)

Results:
~# time sh -c “dd if=/dev/zero of=./ddfile bs=8k count=20000 && sync”
20000+0 records in
20000+0 records out
163840000 bytes (164 MB) copied, 12.4337 s, 13.2 MB/s

real 0m22.839s
user 0m0.090s
sys 0m2.270s

  • Test #3 – 512M Pi booting from SDCard and the root filesystem is mounted on a USB SATA hard drive (pretty generic enclosure holding a 250G drive from an old laptop) accessed via an externally powered USB hub.

~# time sh -c “dd if=/dev/zero of=./ddfile bs=8k count=20000 && sync”
20000+0 records in
20000+0 records out
163840000 bytes (164 MB) copied, 3.72608 s, 44.0 MB/s

real 0m7.007s
user 0m0.150s
sys 0m2.910s

We’ll call this Test #4 – Just for purpose of comparison my desktop machine yields these results with the same command:

To an identical 16G Cruzer thumbdrive as used above:

$ time sh -c “dd if=/dev/zero of=/media/2085-C964/ddfile bs=8k count=20000 && sync”
20000+0 records in
20000+0 records out
163840000 bytes (164 MB) copied, 33.3711 s, 4.9 MB/s

real 0m37.200s
user 0m0.000s
sys 0m0.332s

Just for grins to the primary hard drive on this box –
~ $ time sh -c “dd if=/dev/zero of=./ddfile bs=8k count=20000 && sync”20000+0 records in

20000+0 records out
163840000 bytes (164 MB) copied, 0.167818 s, 976 MB/s

real 0m2.845s
user 0m0.008s
sys 0m0.184s

All of the Pi’s are running the latest Wheezy build with all updates applied (as of the writing of this article). Filesystems are all ext4.

Just for completeness, the last test was not to disparage the performance of the Pi’s in any way.  My ‘desktop machine’ is way overkill for most purposes, AMD Phenom X6, 8G RAM, and a 2T sata drive.

Conclusions:
In the Pi  – The SD card beat the USB by more than double the throughput!  Granted this is a rather large Class 10 card. I was a little surprised at the difference being so great.  However it’s painfully obvious the slowdown is not from the Pi, it’s the thumbdrive itself (very minor difference in timing from the Pi vs. my desktop).

While the large Class 10 SD Card does perform pretty well, adding an external hard drive for faster data writes would improve performance by taking advantage of any cache on the drive itself, for any write intensive application such as a database where IO waits are less acceptable.

When choosing the file-system media for your Pi, a little experimentation will go a long way… but bear in mind there are trade-offs on each side, things like power consumption. Also the  simple fact there are a finite number of times flash drives may be written to, although wear leveling is getting better all the time, I’d still suggest larger is better with SD Cards to spread the wear out thinner for a longer life.

Final Conclusion – I need more Raspberry Pi’s!

Update I ran the test again with the root file system mounted over nfs (booting the kernel from the SD Card and the root is immediately mounted via NFS).  Just a hunch but I think the real limiting factor is the ethernet port, even locked at 100M/full duplex through a 1000M switch (the nfs server is running Slackware 13.1 with 1000M/Full NIC)

Results:
#time sh -c “dd if=/dev/zero of=./ddfile bs=8k count=20000 && sync”
20000+0 records in
20000+0 records out
163840000 bytes (164 MB) copied, 25.214 s, 6.5 MB/s

real    0m25.325s
user    0m0.060s
sys    0m1.480s

Half the speed of the Class 10 SD Card