how to boot raspberry pi 4 from A USB SSD or Flash Drive – Episode 3

3, Jan 2021 | Raspberry Pi Series | 7 comments

Difficulty = Medium

Today we are going to be showing you how to boot raspberry pi 4 from a USB SSD or flash drive. This is Episode 3 in our Raspberry Pi series and is optional.

Note: Only follow this episode if you intend to move the Raspberry Pi Operating system from the SD card to an external Solid-state drive or USB flash drive. If not skip this episode and continue on to Episode 4.

Why would you want to boot a Raspberry Pi from an SSD or Flash Drive?

Micro SD cards are cheap and wield high storage capacity which is great for Raspberry Pi’s when doing small projects or tinkering.

However, SD cards are prone to unexpectedly failing or corrupting data. Especially when the card is being written to regularly.

Continuous writing over time to a Micro SD card is not a good idea and will at some point cause data corruption or even worse the complete failure of the card leading to data loss.

Power fluctuations and outages can also plague the Raspberry Pi’s and this can also affect any data being written at the time the system power outage happened again leading to data corruption.

This happens more often than gets reported. In the 6/7 years, we have been using Raspberry Pi’s we have had 3 SD cards die in production and several data corruptions which have resulted in complete data loss and a fresh rebuild was needed.

This is why taking a Micro SD card backup frequently will ensure you have a drop-in replacement in case your SD card dies. We will have a guide on how to do this automatically COMING SOON!.

For a server environment, we need stability and up-time and due to this, we recommend moving the micro SD card boot partition and OS to a dedicated external SSD or USB flash drive.

What SSD Drives do we recommend:

We hope you love the products we recommend! Just so you know, we may collect a share of sales or other compensation from the links on our website. Thank you if you use our links, we really appreciate it!

Crucial BX500 120 GB Internal SSD, BlackSanDisk SSD PLUS 120 GB Internal SSD, Black

What Flash Drives do we recommend:

SanDisk Extreme Go USB 3.1 128 GB Flash DriveSanDisk – 128GB Ultra Flair USB 3.0 Flash Drive

Prerequisites:

You should have the Micro SD card inserted into your Raspberry Pi 4 with Raspberry Pi OS Lite installed onto it. If you haven’t got this far please follow our previous guide on how to do this.

You should have the Ethernet cable connected to the router or networked switch, power supply, mains powered USB 3.0 hub and the SSD drive all connected and your raspberry pi should be powered on. You should see lights coming from the Pi.

how to install Raspberry Pi OS on an SSD or USB Flash drive

You will need to have another computer on the network to connect to the raspberry pi 4 over SSH.

You will also need another computer to write the Raspberry Pi OS to the SSD later on in the post.

You will also need to know what your Raspberry Pi’s local IP address is. To find that please follow this GUIDE: https://www.addictedtotech.net/how-to-find-your-raspberry-pis-ip-address-on-your-local-network/

Please also make sure that when using the Raspberry Pi 4’s USB ports that you are using the Blue colored ones which are 3.0 supported.

Ok ready… Lets get started.

Connect to your Pi over the network via Secure Shell (SSH)

First, we need to SSH (Secure Shell) into the Raspberry Pi over the network using a terminal. From here we can run commands directly on the Pi. We showed you in the previous Episode how to enable SSH so if you haven’t watched it feel free to skip to the part where we show you how to do this.

On Windows:

Please follow our How to install PUTTY on Windows 10 Guide here

Once installed open PUTTY and enter in you IP address

Then click “Open”

Accept any prompts

Now login with the Pi’s default username:

pi

and enter the Pi’s default password when prompted

raspberry

Press Enter to log in.

On Linux & Mac:

You can open a terminal window by opening the Terminal application.

Type the following into the terminal

ssh [email protected]<YOUR_IP_ADDRESS>

You should now see the Raspberry Pi’s terminal splash screen.

Getting the Raspberry Pi up to date

Before we start we want to make sure our Raspberry Pi is up to date and has all the latest packages installed.

In the terminal

First we need to make sure the Raspberry Pi packages are up to date. This downloads package information from all configured sources.

sudo apt update

Next we need to upgrade all installed packages to the latest version

sudo apt upgrade

Now we need to upgrade any Operating system updates including the new bootloader which was released after 3rd September 2020 which enabled booting from USB.

 sudo apt full-upgrade

Now we are going to change some settings in the raspi-config menu so that on boot the Raspberry Pi will look for the bootable USB mass storage device first. If the device is not present then it will fall back to the Micro SD card also known as 0xf41 Boot mode.

sudo raspi-config

You should now see the Raspberry Pi Software Configuration Tool (raspi-config) splash menu.

From here you need to navigate down the list to “6 Advanced Options”

Then go down the list to “A6 Boot Order”

Then select “B1 USB Boot”

Just press enter and you should see some code execute than the menu screen should show the prompt screen which will say “USB device is default boot device”

Press “Ok”

Then navigate down the main splash screen to “<Finish>” and press Enter

You will now need to reboot.

Press Enter on “<Yes>”

Your Raspberry Pi will reboot. At this time back into your Micro SD card.

Reconnect to your Raspberry Pi using SSH

Once it has finished booting reconnect to your Raspberry Pi through SSH.

ssh [email protected]<YOUR_IP_ADDRESS>

Verify that the Bootloader is up to date

We can now verify if the EEPROM Bootloader firmware is up to date

sudo rpi-eeprom-update

If you get similar to the following then everything is as expected

BCM2711 detected
Dedicated VL805 EEPROM detected
BOOTLOADER: up-to-date
CURRENT: Thu  3 Sep 12:11:43 UTC 2020 (1599135103)
 LATEST: Thu  3 Sep 12:11:43 UTC 2020 (1599135103)
 FW DIR: /lib/firmware/raspberrypi/bootloader/critical
VL805: up-to-date
CURRENT: 000138a1
 LATEST: 000138a1

You should get an output from the rpi-eeprom-update. If it says that there are any updates you can install these manually by running

sudo rpi-eeprom-update -a

Edit the Bootloader Configuration

Now we are going to verify that the rpi-eeprom -config configuration is correct by doing the following

sudo -E rpi-eeprom-config --edit

The default configuration should look similar to this

BOOT_UART=0
WAKE_ON_GPIO=1
POWER_OFF_ON_HALT=0




[all]
BOOT_ORDER=0xf41

We need to confirm that our configuration files BOOT_ORDER parameter matches “BOOT_ORDER=0xf41” which is the correct and new parameter. If it has “0x1” or “0x0” (Which was set in versions prior to 3.9.20) then you will need to go back over the steps above from the beginning to make sure the bootloader gets updated.

Other BOOT_ORDER values and their descriptions

The value we want is 0x4 USB mass storage device boot.

You can combine other values from the table above but we only recommend using either one of these two values:

BOOT_ORDER=0x4 = Boot straight to USB mass storage

BOOT_ORDER=0xf41 = (Fall back to SD card IF USB boot fails)

However all should be as expected if you have followed the guide correctly.

Now you need to exit nano editor by pressing “Ctrl + X” and then “Y” to save and doing so will also re-update the EEPROM and ask you to reboot.

To reboot type

sudo reboot

Installing Raspberry Pi OS onto the SSD

Well done you got this far. Just one more thing to do!

To finalize the process we need to write a fresh Raspberry Pi OS image onto the SSD or Flash drive.

Insert the SATA USB 3.0 adapter into the SSD and attach the USB port to your computer. Please ensure you use the blue 3.0 USB port and that no other SD cards or USB storage devices are connected.

Please follow our previous Episode how to install Raspberry Pi OS to SD card but instead of writing to the SD card, we will write to our SSD drive or flash drive instead.

Please note on Windows the SSD (if new) may not show up in “My PC” as if it has not been formatted. However, the Raspberry Pi Imager will see it fine so you don’t have to do anything else.

Once you have the Raspberry Pi OS imaged to your SSD drive please remember to add the ssh file to the boot partition so you can SSH into your new SSD powered Raspberry Pi :).

You can now safely remove the SD card from your Raspberry Pi and insert the SSD drive into your powered USB 3.0 hub or directly into your Raspberry Pi 4’s USB 3.0 port.

Power up the Raspberry Pi and you are done.

Enjoy a more stable server and operating system.

Let us know how you got on? How did you do?. Did you have any problems?

Can you add anything helpful to this post to help others?.

Let us know in the comments below or on our YouTube channel.

7 Comments

  1. Steve

    The boot load order is actually read right to left, so a boot load order of usb>sd would be 0xf14

    Reply
  2. Daves Newide

    I am wondering why we can’t just copy the recently updated SD card contents (with all the password and user customization already performed) onto a blank ssd and go from there…!? Is there something I’m missing or don’t understand about this topic?

    Reply
  3. Jacob

    Thanks for all your videos! I have mine running off of a usb 3.0 memory stick. Whenever it boots, I have to utilize the following command to “sudo mount -o remount, rw /” or else I get read only errors for any command I try to run. Did I miss something or do I need to mount my mem stick every time I reboot?

    Reply
  4. Mark

    Easy to follow guide – thanks. At the time of writing (Feb 2022), the raspi-config options have been rewritten to give 3 boot options
    B1. SD, otherwise USB
    B2. USB, otherwise SD
    B3. SD, otherwise Network

    Selecting B2 gives a BOOT_ORDER of 0xf14, confirming Steve’s comment as correct.

    Reply
  5. Uffe

    Thanks for great guide(s). In episode 5 we inastalled OMV, but it turns out I have no filesystem to use, and cannot create Shared Folders.. I do have the SSD disk showing up.. But why is this? What do I need to do to be able to create shares, like You do in the video?

    Reply
    • Addicted2Tech

      You will need to use an additional drive to store data. It is due to how OMV handles boot data. It uses the whole drive as a boot drive and as far as I know there is no work around other than to use an additional drive. You could boot to a USB flash drive or just use the SD card and then you can free up the SSD for storage. Let me know how you get on.

      Reply
      • Uffe

        Thanks for reply 🙂
        I just assumed, that the SDcard could not handle all the I/O over time, and the speed is also significant. When installing OMV, docker, portainer, pihole, torrentDL and more, it will still use SDcard right?
        I’m not sure what I will do now.

        Reply

Submit a Comment

Your email address will not be published.

<a href="https://www.addictedtotech.net/author/attadmin/" target="_self">Addicted2Tech</a>

Addicted2Tech

We love technology and enjoy sharing helpful FREE content for others to enjoy. We believe in community. If you like what we do please support us by sharing and liking our tutorials & Subscribing to our YouTube channel. You can also follow us on social media.

Support Our Work!

Donate Via Patreon

Raspberry Pi 4 Model B [8GB] RAM Single Board Computer

Last update on 2022-05-16 / Affiliate links / Images from Amazon Product Advertising API

CanaKit Raspberry Pi 4 Extreme Kit – 128GB Edition (4GB RAM)

Last update on 2022-05-16 / Affiliate links / Images from Amazon Product Advertising API

We Are An Affiliate!

Just so you know, we may collect a share of sales or other compensation from the links on this page. As an Amazon Associate I earn from qualifying purchases.

The Affiliate link recommendations come at no extra cost to you.

We hope you love the products we recommend!

Thank you if you use our links, we really appreciate it!

Related Posts