In this blog post, we’re going to cover how to boot balenaOS on an SSD for Raspberry Pi 4. This opens up many benefits, including faster load read and write times for not only running the OS on edge devices, but also for application operations.
We will be using a USB3 to SATA converter as a go-between our standard 2.5inch SSD, and your regular RPi4 - as the RPi4 doesn’t ship with a SATA or PCIe port exposed.
Booting your OS from an SSD can yield far faster, snappier results than using an SD card. You’ll get much better read and write speeds and, in many cases, SSDs are just more wear and tear-resistant than SD cards.
Booting from an SSD is also helpful in:
- Edge projects and applications where you want to set up a device and not worry about it for long periods of time
- Projects in environments where there might be power fluctuations that can be harmful to SD card performance and wear-and-tear
- Edge applications and use cases where you need a lot of storage and can leverage savings from upfront investments into SSDs (by the GB, it’s cheaper to use SSD over time)
We’ve heard community members echo similar reasons for wanting to boot balenaOS from an SSD and for more SSD support. Some folks are curious about booting from an SSD, and some want the reliability increase from SSDs.
The quality of the hardware that you choose matters, especially for the main disk drive of your SBC. Similar to how choosing too low-quality of an SD card causes immature failure or performance issues, this is the same even when moving to SSDs.
From an at-scale, industrial perspective, poor choices in picking the medium can be expensive. For example Tesla has to recall cars because they used eMMC that can’t be easily replaced.
For testing and prototyping, choosing something convenient (by price or ease of access) is fine to get a better understanding of how this works. However, please consider SSDs with a good track record for industrial use before putting SSDs to work in the field in your IoT fleet.
Yes, you should care!
When you search for USB3 to SATA cables on Amazon or any similar site, you are going to find some that support UASP, and some that don’t. Make sure that you pick one that has UASP. It should be mentioned in the description, but another way to tell if UASP is supported is by looking at the chipset that is involved. For example, ASM 1153e is the most popular chipset used in such converters that supports UASP.
Read this article to learn more about the importance and performance benefits of UASP.
You’ll need the following to use this guide.
A Raspberry Pi 4 (for the best performance and results)
A SD card for one of the steps to prepare your device to recognize an SSD (e.g. SanDisk Extreme Pro)
A USB to SSD converter based on the ASM 1153e chipset (like this one, or similarly accessible in your region)
An SSD, options are many, and include:
Crucial BX500 120GB (I’m testing this-- value for money)
Samsung EVO series (supposed to have epic performance)
Flash Raspberry Pi OS Lite on an SD card using balenaEtcher
- Head over to raspberrypi.org, and make sure to download the Raspberry Pi OS Lite. We don’t necessarily need the lite version, but we only need it as a stop gap measure so we are optimizing for quick download
- Enable ssh, in case you don’t have a spare screen and keyboard handy.
- To enable SSH: Add a file in the boot partition of the just-flashed SD card called
- Unmount or safely remove the SD card from your PC
Plug in the SD card in your Raspberry Pi 4, connect ethernet cable or optionally plugin the keyboard and screen - and turn on the power.
You can either connect a screen and keyboard, or plug it in using an ethernet cable to your router.
Open an ssh terminal to the RPi4 or launch the terminal app.
- Run sudo raspi-config
- Select Advanced Options
- Select Boot Order
- Select USB
Flash balenaOS on SSD
- Download the app you want to flash on your RPi4 by clicking on the Deploy with Balena button on hub.balena.io. For this example we’ll use the Nextcloud app by Balena’s very own Kyle Harding.
- Put the SSD in the USB enclosure/connector - and connect it to the laptop that you are using Etcher on. It should show up as a USB mass storage device.
- Flash the device!
* Unplug the ssd from your computer
- Power down the RPi4 if you haven’t already
- Plug into one of the 2 blue-on-the-inside (those are the USB3 ports) USB ports of the RPi4. Remove the SD card from it’s slot
- Power up the RPi4. Make sure you use a good power supply - at least 20 watts - as the SSD will consume more power than your regular SD card.
- Wait for a couple seconds for the device to connect to balenaCloud. Some USB-SATA converters have an activity LED. Those should be blinking during this process.Once it does, you should see something like the following for your device -
At some point, we can remove more friction from this guide by eliminating the eeprom update steps. Until we get to that point, users will either need to just follow the guide as-is, or some courageous, talented community members can help us create a Project to containerize these steps. It’s a great way to meet some of the balena crew, learn about Projects and Blocks, and level up your edge development skills.
If you’re interested, please get in touch via the comments or on our Forums.
This guide is a first version of what will hopefully be a much smoother process. We’re researching ways to reduce the number of steps to install balenaOS onto an SSD. We didn’t want to wait on fully polishing that path, so we released all the steps in this guide so that our users and community could get started.
Our team will also try and compare a few different brands of SD cards and SSDs to do a little benchmarking of read and write speeds. Once we get our hands on a few more CM4 boards, we’ll do some tinkering and testing here as well.
Did you get balenaOS to load on your device via SSD? Congratulations! You’re now ready to enjoy the benefits of fast, reliable, and cheap - albeit a little bulky - storage on your Raspberry Pi 4. Some apps that can benefit from a faster, more resilient storage device include:
- Edge/IoT display projects, like Screenly OSE and balenaDash
- Projects where you need to write sensor data to a volume over time, like balenaSense and balenaPlant
- Video and surveillance projects, like balenaCam and Kerberos.io
- Minecraft Server
- Image Classification, like Edge Impulse
- …and more on balenaHub
Now that you have a RPi4 configured to boot from a fast SSD over USB - check out all the above apps on hub.balena.io. Let us know about your new projects on our Forums. We’d love to see how using an SSD inspires new project ideas or breathes new life into ones you’re already running.