Testing SD cards from within Raspberry Pi
Testing how varoius SD cards will perform in Raspberry Pi
SD cards performance on Raspberry Pi is continuously a hot topic. There is a lot of SD cards so there is no easy solution to the search of optimal SD cards. I've gathered few SD cards to test their performance under Raspberry Pi. For comparison I've also added USB stick and a USB connected HDD.
So does Raspberry performance is limited by SD cards or maybe some other part is the bottleneck? Check out the results.I used six SD cards of different speed classes and vendors:
- SanDisk Extreme 16 GB: UHS-I class 10 with transfer up to 45 MB/s (link)
- Transcend SDHC Premium 8 GB: class 10 with transfer up to 17-20 MB/s (link - different capacity)
- Kingston SD10V 4 GB: class 10 with transfer at least 10 MB/s (PDF)
- SanDisk Ultra 4 GB: class 6 with transfer up to 30 MB/s (amazon, this variant seems quite rare and not listed on SanDisk webpage)
- Sony SF-8C4 8 GB: class 4 with transfer up to 15 MB/s (link, my one has 15 MB/s on the sticker)
- SanDisk SDHC Blue: class 4 (link)
There is few SanDisk cards as multiple user benchmarks show that those cards have very good performance, especially for random read/write operations. So in this test I'll check if slow and fast SanDisk SD cards provide advantages over other SD cards.
Fastest cards, like the Extreme family are the most expensive. Class 4 basic cards are cheapest so you pay for the speed you choose. In theory class number is the MB/s of read/write transfer the card will give. Class 4 is 4 MB/s and class 10 is 10 MB/s. However cards can be faster. SanDisk Extreme are UHS-I cards providing much faster transfer. Similar speeds are give to other tested cards (at least according to specification).
Raspbian image burn time
Using Kingston MobileLite G3 card reader (very good one) I've burned occidentalis (raspbian) image on every card. Time needed to burn the image varied between cards:
Order of the cards in the results matches the speed order I've made at start. UHS-I Extreme SanDisk first, and then class 10 cards. Slowest class 4 on the end. The class 6 SanDisk Ultra turned out to be quite fast. If you burn images often then a fast SD card and a good card reader will make it shorter.
As for card readers I had some problems with my laptop card reader - it didn't produced bootable systems for my Odroid board. Using Kingston reader that supports newer SD card specifications solved the problem. "Bad" card readers may also cause problems on Raspberry (I wonder how many bad card reports on the eLinux wiki are actually card reader problems?).
IOzone benchmark on Raspberry Pi
Using phoronix test suite I've tested each SD card with IOzone benchmark. Results are on openbenchmarking.org and below with description.You can compare your system performance with my results by executing:
You have to have phoronix-test-suite installed. If it wants to install some system packages then install it directly as on Raspbian it won't authenticate correctly to do it (it needs at least: php5-cli, php5-gd, php-curl mesa-utils zip)
SanDisk Extreme was tested in few configurations. "extreme" is a system installed via Berryboot on AuFS partition (RaspRazor, Raspbian). "extreme raspbian" is the default occidentalis 0.2 (used for other cards too), while "extreme raspbian latest" is a test on fully upgraded system.
SD card read tests
Most of the cards reach around 20MB/s of read speed (such similar results may imply that something is limiting the read speed). At 1 MB records the speeds start to differ a bit. Slowest are Transcend and Kingston cards (while they don't have the slowest classes).
SD card write tests
In the write tests the cards got back to their places. UHS-I SanDisk is the fastest, then class 10 cards and class 4 at the end as the slowest.
Summing up all results (MB/s) we can see which card was fastest or slowest. Blue SanDisk was slowest (high read speeds didn't helped due to very low write speeds), close to class 4 Sony SD card.
RaspRazor on AuFS partition was fastest. Some more comparison tests are needed but it may be that AuFS will be bit faster than ext4 for SD cards and Raspberry. With more modern kernel (3.8 - 3.10) there would be also F2FS files system designed by Samsung for various Flash storage devices.
All cards performed nicely. None of them failed to perform accordingly to its specification. It looks like that a good class 10 SD card would be optimal. Faster UHS-I and alike SD cards will hit the ~20MB/s limit and will also cost much more.
Checking max transfer rates of Raspberry card reader
In IOzone tests most of the cards had around 20 MB/s of read speed. At least the Extreme SanDisk should be faster. Is Raspberry limiting the speed somehow?. Using gnome-disk-utility on Raspberry and on my laptop I've made a read benchmark on the SanDisk Extreme card (under Raspberry when used, and in Kingston card reader connected to my laptop).
On Raspberry the card got around 22 MB/s of read speed. When used in a card reader - 32 MB/s. So it looks like Raspberry has a limit around 20 MB/s.
External storage devices
With Berryboot you can install your system on an external device like a USB stick or HDD connected via USB (quite likely a powered USB hub or Atrix Lapdock powered USB port). So I've tested basic and cheap ADATA C008 (4GB) USB stick and Hitachi HTS723232A7A364 (320 GB, 2,5") HDD. gnome-disk-utility tests as well as IOzone tests shown that the cheap USB stick got only 4 MB/s of write speed and quite good read speeds. Slow write speeds is quite common among "cheap" USB sticks. Good ones cost as much as good SD cards, so nothing gained.
HDD turned out quite nicely. It got around 22-25 MB/s of read and write speeds. On my laptop it got around 36 MB/s so yet again something may also affect max transfer rates that are achievable on Raspberry.
Random read/write operations, or small file operations may have different performance and affect for example server performance (requests handling, small files write/read/update operations). I've used two tests: pts/blogbench and pts/nginx to check few cards for server performance differences. Results are on openbenchmarking. The blogbench test emulates various types of requests covering everything that could happen on a HTTP server with an website. Nginx test counts how many requests per second the system can handle.
Raspberry got similar results between SD cards. The same SanDisk Extreme in much stronger Odroid-X2 board got vastly better results. So Raspberry Pi isn't limited by SD cards. Hardware (CPU/RAM/alike) is the limiting factor.
Here the results are similar, although SanDisk extreme got slightly better result than other cards. Odroid-X2 also was the total winner.
If you want to play movies or music from your Raspberry get an external HDD. It will give you big capacity for lowest price and also maximum read/write performance. When you need something only to hold a system for programming, or other basic usage - use a good, but not super-performance SD card. Good class 10 SD card will be the best pick of performance / price.
The tests didn't covered all aspects of I/O operations. But in those I made the SanDisk cards performed good, but not better than other cards (when comparing the non UHS-I Ultra card with Kingston and Transcend class 10 cards). SanDisk may be good, but so are other SD cards.