I’ve covered the benefits of taking your Raspberry Pi to a solid state drive (SSD) before extensively in this article but in a nutshell you get around a 280% increase in raw throughput and a 1000% increase in 4k random read/writes over a MicroSD card.
That’s fantastic but SSDs have traditionally been very expensive costing you as much as 4+ Raspberry Pis so it seemed silly to use a drive like that as Pi storage. Until now.
That’s right. Thanks to technologies such as 3D NAND flash solid state drives for consumers have now become cheaper than mid-high range MicroSD cards. With 10x the performance of MicroSD cards they are now a no-brainer upgrade for servers or IO intensive Raspberry Pi projects.
Why Choose SSD?
MicroSD cards were not designed to serve as living storage for operating systems. They are designed for devices such as cameras and smart phones that need to write and reliably store data. They’re very good at this and some cards have excellent throughput fast enough to even record 4K video.
But one thing they are not good at is 4k random writes and rewrites. These are small writes throughout a disk and consist of about 25% of all hard drive activity on a computer. Almost every action you take and even routine log file updates trigger these updates so they are very important for performance.
To show you the difference in performance I have developed a benchmark that anyone can run and uploads the results to the site. Click here to learn more about the benchmark and results.
As you can see all of the top spots in the results are held by solid state drives. Further, solid state drives beat the fastest MicroSD cards by about 300%.
MicroSD performance varied wildly based on quality of the card. But even the very best and most expensive MicroSD cards got absolutely destroyed by even the cheapest solid state drives. This is because SSDs are so fast that they are limited by the speed of the Raspberry Pi’s USB 2.0 ports.
Solid state drives also have very large write caches. This lets your Raspberry Pi push data to the drive and start doing other things and let the drive itself figure out how to organize the data. Much of the throughput and other performance differences in the above chart are because of much better and faster read/write caching.
Which SSD to Buy?
Since all models and types of solid state drives hit the Raspberry Pi’s USB 2.0 transfer speed limit you should buy the cheapest one that fits your needs!
If your Raspberry Pi is mostly stationary it’s easiest and cheapest to just use a normal 2.5″ SATA SSD with a USB adapter. Here’s my recommendation:
The Kingston A400 drive performs really well in the Raspberry Pi Storage Benchmarks. It’s a great drive and is cheaper than many mid-range MicroSD cards.
The 2.5″ SATA to USB adapter above allows us to do this. There is no power adapter needed as SSDs are low power and are powered by the Pi through USB.
Compact SSD Options
If you move your Pi around a lot or need something more compact there are several options.
There are some flash drives (a very small number) that are actually solid states. This one is the best one. I actually have a old discontinued model in my picture above. You have to be extremely careful when looking for these as 99.9% of flash drives are NOT solid states. The SanDisk Extreme Pro is a true solid state. The cheaper SanDisk Extreme and Extreme Gos are not (needs to be the pro). If you are looking at a flash drive and they don’t explicitly state it’s a solid state drive then it surely isn’t!
Option 2: Build from parts
Unless you already have an old solid state you can use the price of the adapter + the drive will likely be more than the SanDisk above. If you can find killer deals on eBay you may be able to save a little bit.
You can build a M.2 USB stick but you need to be careful with which type of M.2 drive you have/buy. They can be B-key, M-key, or M+B keyed. By far the most common and cheap ones are SATA with a B or B+M key. The adapter I have is this one.
In the picture above of different storage types you can see I am using an old mSATA drive as a USB stick. To learn how to build one see my article on turning old mSATA drives to USB SSDs here. These SSDs can be picked up pretty cheap on eBay but I wouldn’t recommend buying one new as they are now specialty parts since M.2 has replaced mSATA.
Benchmark Your Storage
To get a good idea of what kind of performance improvement you can expect you can run the exact same benchmark featured in the table above.
To run the benchmark type/paste:
sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash
Compare your results to the other benchmarks here. Pay special attention to the 4k random read/write tests such as IOZone and FIO. These best reflect everyday usage on the Pi and determine how fast it will respond and perform.
Create Bootable Drive
Creating your bootable drive is also very easy. You simply image it the same way you would image a blank MicroSD.
I use Win32DiskImager and simply select the USB attached drive just like you would with a MicroSD card and write the image. It’s very easy!
Don’t forget to place an empty “ssh” file in the /boot directory if you want to connect via SSH.
Prevent High CPU Usage
There is an issue where using a solid state drive will cause kworker to consume around 10% of your CPU all of the time. This is due to the Pi polling constantly for a Micro SD card to be inserted.
There are two ways to fix this. One is to insert a blank Micro SD card in the Micro SD slot and leave it there all the time. The other is to add a line to your /boot/config.txt. Open up config.txt and add the following:
This option will tell the Pi to only check for a Micro SD card once at bootup. This means if you want to access the card it needs to be in the Pi before it boots up.
SSD With Raspberry Pi 4
The Raspberry Pi 4 does not support USB booting like it had in the 3 series at launch. They plan to add this feature back in at a later date. I have found a workaround for this so check out my guide on how to set up USB drives in the mean time.
SSD With Raspberry Pi 3
Once you have chosen your SSD it is time to configure the Raspberry Pi to boot off USB storage. Fortunately this is extremely simple. To enable booting from USB storage simply boot up your Raspberry Pi and run this command:
echo program_usb_boot_mode=1 | sudo tee -a /boot/config.txt
Alternatively you can put your MicroSD into your computer and open /boot/config.txt and add the line:
Now reboot your Pi and USB boot support will be permanently enabled. This only needs to be done once per Raspberry Pi as the change is permanent.
You may now remove the Micro SD card altogether and plug in your external storage you prepared in the previous section. Power up the Pi and it will boot directly from the USB storage!
SSD with Raspberry Pi 1 / 2 / Zero W
The older Pi family and the Zero / Zero W also support USB booting with a small catch. You still need to have a Micro SD card inserted in the Pi with only one file on (bootcode.bin). This is because these Pis use the older
BCM2835 which is a Micro SD only bootloader.
The good news is that if we put a otherwise blank Micro SD card in there with this file the Pi can boot from USB storage just fine and take full advantage of the increased speed and storage size. Bootcode.bin basically provides the instructions to the Pi telling it how to boot from USB.
First you will format your Micro SD card as FAT32 . FAT32 is the partition type that the Pi bootloader can read and is the same format as the /boot/ partition on a fully imaged Pi card.
Next grab the latest bootcode.bin from the official Raspberry Pi repository at https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin
Copy the bootcode.bin file onto your newly created and otherwise blank FAT32 imaged Micro SD card and then insert the Micro SD card back into the Raspberry Pi.
Now connect your USB storage back to the Pi and power it on. The Pi will boot directly from your USB storage device!
A solid state drive is the biggest upgrade you can give your Pi. When I am configuring my Minecraft Raspberry Pi servers the performance difference is night and day. They boot faster, respond faster and write/read much faster. It’s very difficult to go back to MicroSD after using one of these with your Pi.
This should be a future proof upgrade as well because presumably the Raspberry Pi 4 will have USB 3.0 and support much higher transfer rates. At this point the individual performance of SSD drives might actually matter but for at least the next couple of years until the Pi4 comes out it makes sense to buy the cheapest drive possible.
I highly recommend running the benchmark for yourself to get an idea of how much performance you can gain!