After publishing my Raspberry Pi Minecraft Server tutorial I got some feedback on Reddit to try using a USB SSD for storage. I expected some marginal improvement but nothing spectacular due to the USB 2.0 bus data rates. In fact the results were so spectacular that I’m changing my storage recommendations entirely. Let the games begin!
- Samsung Evo 32GB MicroSD*
- Samsung Evo+ 32GB MicroSD*
- Samsung Pro Plus 32GB MicroSD*
- SanDisk Ultra 64GB MicroSD*
- EMTEC 64GB MicroSD*
- SanDisk Cruzer Glide 16GB Flash Drive*
- SanDisk Extreme 64GB Flash Drive*
- Hynix mSATA 128GB Solid State Drive*
- Crucial 2.5″ MX Series SATA Solid State Drive*
Each drive was imaged with Raspbian Lite and booted up once and a sudo apt-get update && sudo apt-get upgrade was issued. After a reboot the testing began. The mSATA solid state drive uses a USB 3.0 adapter to create a really cool flash drive (see my article here on how to make one). The Crucial solid state drive uses a 2.5″ SATA to USB 3.0 adapter*.
The Raspberry Pi 4* was set to boot from USB mode so the entire operating system was running on the solid state drives just like the mSATA drives to provide a fair playing field.
The most important factor performance wise for a card running an operating system is small random read/writes. The operating system is constantly reading/writing these. The dd test measures raw throughput and represents what performance you’d see transferring a large file. Some storage devices have very high throughput but poor 4k read/writes which indicates a poor medium to use as a card for your Raspian operating system.
Alright, on to the testing!
Benchmarking / Testing Storage
If you want to verify your drive’s performance you may want to run my storage benchmark with:
sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash
If you search for the model of your drive on Pi Benchmarks you can compare your score with others and make sure the drive is performing correctly!
|4k random read
|4k random write
|Samsung Pro Plus
|SanDisk Cruzer USB
|SanDisk Extreme USB
|Hynix mSATA SSD USB
|Crucial 2.5″ SATA SSD USB
The cheap MicroSD cards performed about as poorly as expected. If you are running one of the generic cheap MicroSD cards in your Pi you are *really* slowing it down. The difference from a generic EMTEC to a Samsung Pro Plus is staggering. The raw dd throughput is 280% faster but the 4k random writes are 1000% faster on the Pro Plus! You really do get what you pay for with a MicroSD card.
Now on to the flash drives. The SanDisk Cruzer USB Flash drive is only a few bucks. It performed predictably poorly. Even mid range MicroSD cards beat it in every category and it was dead last in the dd test. However don’t write off USB flash drives yet, because the SanDisk Extreme 64GB *crushed* it in 4k random writes. Although the raw dd test throughput lost to the Samsung Pro Plus it is 233% faster when it comes to random writes. None of the MicroSD cards come even close. Conclusion? If you use a very good USB flash drive you will outperform MicroSD cards fairly easily as there are much faster drives out there than the SanDisk Extreme I used in my test.
Now let’s talk about the final category and the true winner here: SSDs. It’s not even close folks. These drives are maxing the bus. They have no weaknesses in any category and are faster than the most premium of all other storage mediums. The two SSDs tested are not the same speeds. They are just so fast that they are faster than the USB 2.0 bus can handle and it maxes out somewhere around 35MB/sec. We are talking a 540% gain in 4k writes over the Samsung Pro Plus (not at all a cheap card).
The big takeaway here is that YES, they are worth using over MicroSD cards and flash drives. On average you are getting at least 4x the random 4k write speed by using a solid state drive with your Raspberry Pi than the most premium of MicroSD cards can provide. Unless you need your Pi to fit somewhere small and can’t fit a USB-based storage medium into your project, solid state storage is the best choice and clear winner!