In this tutorial, we’ll work through setting up a Raspberry Pi 4 to boot from a USB connected SSD or other USB storage media. There is quite a bit of information on this online already, but I’ve had a lot of questions recently about how to do this, so I thought I’d share my method.
I’m going to be doing this on my latest plywood Pi case build with an M.2 NVME drive, but the process is the same for any USB attached solid-state, flash or disk drive. It also doesn’t matter what type of SSD you’ve got, as long as you’ve got an adaptor to convert the SSD interface to a USB interface, then you should be able to get your Raspberry Pi 4 to boot off of it.
Here’s my video tutorial if you’d prefer:
What You Need For This Tutorial
- Raspberry Pi 4B – Buy Here
- 1TB NVME Drive – Buy Here
- NVME Drive USB C Adaptor – Buy Here
- Sandisk Extreme MicroSD Card 32GB – Buy Here
Preparing Your SD Card
To make it easier for beginners to follow, I’m going to assume that we’re starting from scratch. If you’ve already got your Pi running on a microSD card then skip past this first section.
I’m using a 32GB SanDisk Extreme microSD card, but you can use a smaller 16GB card if that’s what you have available.
We’re going to start out by using Raspberry Pi Imager to flash the Raspberry Pi OS image to our SD card. This is done by selecting the operating system, which in our case is going to be the 32bit version of Raspberry Pi OS. We’ll then choose our target, which is our SD card, and then click on write. This will then download the operating image and flash it to your SD card. So, depending on your internet speed, this may take around 5 to 20 minutes to complete.
When it is complete, plug the SD card into your Pi. Don’t close up any covers on your case yet as you’ll want to remove it again once your Pi is booting from the SSD.
Format Your SSD
The next step may or may not be required, depending on what filesystem your SSD has been formatted in. If you’re unsure, try plugging the drive into your Pi when it has booted up and see if the drive icon appears on your desktop.
If it doesn’t appear, you’ll need to reformat the drive to use the FAT32 file system. This is easily done in windows by right-clicking on the drive and selecting format, or on a Mac by using the disk utility and selecting MS-DOS (FAT) and the default scheme.
Once this is done, you can plug in your SSD and boot up your Pi if you haven’t done so already. Remember to plug the SSD into one of your USB 3.0 ports, which are the blue ones in the middle.
Your SSD should then appear on your desktop after a few seconds. If it doesn’t appear then it is likely using an incompatible filesystem and should be reformatted to FAT32. If you have done this and it still isn’t showing up then check your USB adaptor and ensure that the drive is properly inserted into the holder/plug.
Configuring Your Pi To Boot From The SSD
Now that you’ve got your Pi booting off your SD card and your SSD is being seen by your Pi, we can move on to configuring the Pi to rather boot from the SSD.
First, open up a new terminal window and, as usual, it is best to start out by making sure that your Pi’s software is up to date. Do this by entering the following commands:
sudo apt update sudo apt full-upgrade
Once this is done, run the following command to update your Pi’s firmware.
Enter y when prompted.
Once the firmware update has been completed, you’ll need to reboot your Pi.
sudo reboot now
When you’re back on your desktop, go to your menu, then accessories and then SD Card Copier. This will open a simple window with a from and a to dropdown list. Select your SD card as the “from” target and your SSD as your “to” target. Then click on Start and Yes to continue.
This will partition your SSD and copy the contents of your SD card to each partition.
Now we just have to tell the Pi to boot from the SSD instead of the SD card.
Open up a new terminal window and enter the following command to make sure that you’ve got the latest boot loader.
sudo rpi-eeprom-update -d -a
Mine looks like it is already up to date.
Next, open up the configuration tool by entering the following command:
Then go to 6 Advanced Options and then A7 Bootloader Version. Select the first option E1 Latest Use the latest version boot ROM software to use the latest software, then select Ok and then No so that it doesn’t revert to defaults.
Next, go back to 6 Advanced Options and select A6 Boot Order. Select the second option B2 USB Boot Boot from USB if available, otherwise boot from SD card.
You can then Finish and then select No when asked if you would like to reboot. Then rather shutdown your Pi.
Once your Pi has shut down. Remove the power cable and then the SD card.
Our Pi should now boot up from the SSD, so let’s power it up and see.
You’ll notice right at the top when booting that it says that the boot mode is now USB-MSD and that no SD card is detected.
When your desktop loads, you’ll also notice that you no longer have the SSD mounted as an external drive, so you won’t have an icon for it on the desktop anymore.
Running A Quick Speed Test On Our SSD
We can do a quick and basic write test by opening up our terminal and entering the following command to write a 100mb file:
dd if=/dev/zero of=./speedTestFile bs=20M count=5 oflag=direct
Our file took just over half a second to write at a speed of 190 megabytes per second
Next we’ll try reading the same file with the following command:
dd if=./speedTestFile of=/dev/zero bs=20M count=5 oflag=dsync
This takes a little under half a second, with a read speed of 215 megabytes per second.
This is a very basic indication of the speed increase you get from an SSD. There is a lot more to the speed of a drive than simply writing or reading a single large file. Here are two good drive speed comparisons, one by Jeff Geerling and one by leepspvideo
Let me know in the comments section below if you’ve got your Pi booting from an SSD and if there is anything you do differently when setting it up.
If you’re interested in putting together your own plywood Pi case like mine, you can buy a kit from my Etsy store.