Raspberry Pi 4 Boot with USB

Raspberry Pi single board computers have historically booted from microSD flash cards. This works OK, but isn’t nearly as solid a solution as an SSD or M.2 hard drive. Earlier in 2020, Raspberry Pi 4 gained the ability to boot from USB which means any hard drive that can be connected to the Pi via USB (typically USB 3.0) and recognized by the OS can be used as a boot device. Most common external boot devices are SSD hard drives and M.2 hard drives – but you could even use something like a USB flash drive.

The problem with booting a Raspberry Pi to an external USB hard drive is that there isn’t much documentation on how to do this properly – when Raspberry Pi’s first gained this capability, it required manual upgrades to Beta bootloaders, and some configuration changes to make it work. This has since changed, and it’s much easier with newer versions of Raspbian – but of course all of that old documentation still exists on the web and can be extremely confusing for anyone searching for how to accomplish USB boot.

So in this tutorial, we’re going to show you how to get a Raspberry Pi to boot from USB as of December 2020 and early 2021.

What you’ll need (Amazon affiliate links):

Raspberry Pi 4 – I recommend the CanaKits as they come with almost everything you need to get started including the microSD card. The CanaKit Raspberry Pi 4 4GB Starter Kit is a great option at $99.99. Or you can bump up to the 8GB version for $20.00 more.

Next, you’ll need a USB 3.0 external hard drive. The drive that I’m using for this tutorial is the Seagate Portable 2TB External Hard Drive. But, I have also successfully configured the Raspberry Pi to boot from M.2 (not NVMe) using the Silicon Power 256GB A55 M.2 SSD with an external SSK Aluminum USB 3.1 to M.2 SSD Enclosure.

Another promising option if you want an all-in-one case with M.2 boot capability is the Argon ONE M.2 case, though I admit that my first experience with this case hasn’t been ideal – the M.2 connectivity was extremely intermittent to the point of being unusable. I have contacted Argon ONE about a replacement or RMA, but have not yet heard back – so buyer beware.

Initial Raspbian Install

Booting from USB first requires that we boot from the microSD just like we would with any other Raspberry Pi installation. The easiest way to format your microSD card with Raspbian is to use the Raspberry Pi Imager application. Download the Raspberry Pi Imager and install it on Windows, macOS, or Ubuntu. Once installed, select Raspberry Pi OS (32-BIT) for the OS and then choose your microSD card. MAKE SURE to double-check that you have selected the correct microSD card as this will overwrite anything that you have on there.

Once you have double and triple-checked that you have the correct microSD card, click the ‘WRITE’ button to flash the card with the latest version of Raspbian.

Next, we’ll want to set up our Raspberry Pi 4 for the initial setup of Raspbian. Plug in a keyboard, mouse, monitor and power adapter to the Raspberry Pi. For my setup, I’m using the Rii i4 Mini Bluetooth Keyboard with Touchpad for keyboard/mouse combo, and the 7″ Raspberry Pi Touchscreen Monitor.

Plug the freshly configured microSD card into the Raspberry Pi and power everything on. After a few minutes, you will end up at the Raspbian desktop with an initial setup wizard. Click ‘Next’ to get started.

The wizard is pretty straight forward. First it will ask about your location information, then it will ask you to change your default Pi user password. Make sure you set the password to something strong.

Next you will be asked about your screen resolution – if you have a black border around your screen, click ‘This screen shows a black border around the desktop’ and click ‘Next.’

Then choose your WiFi network and enter the password, or if you’re going wired, you can click ‘Skip.’

When asked if you want to update, click ‘Skip’ for now – we will update manually later.

Now you’re done! Click ‘Restart’ to reboot the Pi 4.

Once the Pi is back online, let’s first enable SSH and VNC (optional). These two services make the Pi easier to access from another computer.

Click the Raspberry icon in the top left and choose Preferences –> Raspberry Pi Configuration. Then click on the ‘Interfaces’ tab and select ‘Enable’ next to SSH and VNC.

Now, let’s connect via SSH (or open a terminal on the Raspberry Pi desktop) and update the Pi.

sudo apt update
sudo apt upgrade -y

The upgrade will take a while (5-10 mins usually). Once finished, you’re up to date.

Let’s now take a quick benchmark test of our microSD card. To do this, install hdparm:

sudo apt install hdparm -y

Once installed, run:

sudo hdparm -t  /dev/mmcblk0

This will give us our read speed:

This is a basic measurement of the drive – there are a ton of different ways to benchmark, but that is beyond the scope of this document.

Next, let’s add our USB drive. First, shut down the Raspberry Pi:

sudo shutdown -h now

Connect the USB drive and boot the pi back up. Your drive should be mounted as /dev/sda, but you can check this by running:

sudo fdisk -l

In the screenshot above, we can see a 29.9GB microSD drive and a 1.8TB USB 3 drive mounted as /dev/sda. Next, we need to copy all of the contents of the microSD drive over to the SSD hard drive. Click the Raspberry Pi icon at the top left of the desktop and choose Accessories –> SD Card Copier.

Select your microSD card in the ‘Copy From Device’ field, and the SSD (or other USB hard drive) for the ‘Copy To Device’ field. Click ‘Start’ to copy everything from the microSD to the USB drive. This will take a few mins.

Once complete, if you run the fdisk command again, you should see that /dev/sda now has two partitions.

Before we boot to the USB drive, first let’s double-check that our Raspberry Pi is set up to boot from USB if there is no microSD card inserted. Drop to SSH and run:

sudo raspi-config

Navigate to Advanced Options –> Boot Order and press ‘Enter’ on B1 USB Boot. You should get a confirmation page:

Press ENTER to hit OK. Then choose ‘Finish’ on the Raspi-config screen. You will be asked to reboot. Choose ‘Yes’ to reboot the Pi.

When the Raspberry Pi comes back up, we’re now going to want to test out the USB boot. Do a graceful shutdown:

sudo shutdown -h now

Power off the Raspberry Pi, remove the microSD card, and then power it back on. If everything was done correctly, your Raspberry Pi will boot back into Raspbian without a microSD card – this means you’re successfully running on your USB 3 drive!

Let’s run that same benchmark again (but this time against /dev/sda):

sudo hdparm -t  /dev/sda

You should notice much higher read speeds now:

Running the same test, but with an M.2 drive instead of the external SSD, we get even greater speeds:

Comments 17

  1. Your videos are great. Not only do you show every instruction required to perform the task at hand, your videos are very clear and readable, you audio is very clear and you take the time to explain exactly what and why you are doing the particular task.

  2. After booting from ssd,
    I am not able to use the second partition on the sod drive sda2.
    How do I format it for fat32 and use that large partion.. I want use it on other computer as well that is why fat32.

  3. Hay Chris, Happy Holidays to you.
    I’m using the same set up as shown in this post/vid except foe a 512 M.2, and it didn’t work for me.
    With no SD card I have activity lights blinking on both the M.2 board and on the Pi. it gets just past the “hold shift” screen with the raspberry on it . I get a screen of text that disappears before I can read it. The TV screen then goes black. The power lights on the M.2 and the pi stay on, the Pi activity light gives me 2 quick blinks about a second apart.
    I went back and checked my work and found there were 5 partitions on the M.2. I wiped the M.2 again and reloaded the software, again 5 partitions.

    Device Boot Start End Sectors Size Id Type
    /dev/sda1 2048 4978515 4976468 2.4G c W95 FAT32 (LBA)
    /dev/sda2 4978516 1000215215 995236700 474.6G 5 Extended
    /dev/sda5 4980736 5046269 65534 32M 83 Linux
    /dev/sda6 5046272 5570557 524286 256M c W95 FAT32 (LBA)
    /dev/sda7 5570560 1000215215 994644656 474.3G 83 Linux

    Turns out there are 5 partitions on my SD card as well.
    I checked the SD card in in my other Pi4 and that also has 5 partitions.
    I’ve tried everybody’s version of how to do this and have been messing with this for 3 weeks now.
    getting REALLY frustrated.

    Thanks
    Mark

    1. I was able to get this to work on the M2 by installing with a fresh copy Raspi0S on a new SD card.
      It would not work with updated SD cards I had been using in the Pi 4B’s, only with a fresh install.
      It runs well and is noticeably faster, but much hotter. Too hot for my passive case

      Thank you for this post and your video.

      1. Hi there, exactly the same story on my copy of sd card – 5 partitions. To save couple of hours of your life, just follow the guidelines up to USB boot enablement, then prapare your SSD with new image from raspberry org website (image tool available there as well). Then start without SD card. After initial setup SSD is up&running with 2 images only (/dev/sda1 and sda2). Done! No need to waste time.

        Before preparing your SSD, make sure with old setup that OS detects the SSD when plugged in. Drive icon should pop up on the desktop and disk should be accessible. Once succeeded – go ahead!

        Finally, the power of Rpi 4 + any serious application for home automation, servers, and network tools can work flawlessly for a long time!

  4. I like your videos. Lots of good ideas. I’m into Raspberry Pi 4, Argon One cases and now the M.2 case. I have found the recommend Silicon Power 256GB A55 M.2 SSD shows up on my Linux systems as a /dev/sr0 which is a link to /dev/cdrom and /dev/cdrw. Having problems with format. Any suggestions.

    I plan to use the systems as Ubuntu 20.10 and SUSE Leap. I have already used both of these OS’s on SD cards on the Rpi 4.

    1. Please disregard my previous comments. I was trying to take a short cut with the Argon One M.2 case to load a OS on the SP SSD and it does not work. A complete assemble of the Argon One M.2 case will allow one to load a 64 bit OS onto the SSD, with the assist of the microSD card. Easier access to the microSD on the M.2 case would make life easier.

      Thanks again for all of the good videos.

  5. I followed all the instructions, when I get to the point of setting the boot order I get the following error message: “No EEPROM bin file found for version 2020-10-28 – │ │ aborting”.
    Any suggestions on how to fix this issue?
    Thanks

  6. Thank you. Worked like a charm first time around.

    Followed instructions elsewhere (after an SD card failure) which didn’t work. Your instructions had a few additional steps that did the trick (such as removing old partitions).

  7. Hello Chris,
    Many thanks for your tutorials, which are very interesting and pretty well documented.
    I went through the settings of a SSD connected to USB and was able to create the two partitions and define the USB as a boot alternative in case of no SD card.

    At reboot, however, the SSD, although connected, is not detected. ans the bootloader run and run again unsuccessfully without end.

    After reboot from the sd card , mount -l does not detect, nor fdisk -l. even if the disk is present (i.e connected). However, I notice that the little power led of the disk is off, and I need to unplug/replug the ssd in order to see the 2 partitions with fdisk -l.

    The SSD is a 120GB Kingspec.

    This is puzzeling for me and any clue on how to start with a powered SSD would be welcomed !

  8. The raspberry pi 4 after update and upgrade now can be configured for booting by using sudo raspi-config so after copy sdcard image to usb / usb hard drive just select ist boot from usb. it works.

  9. I followed your instructions and after verifying the Pi will boot off the SD card, I then did the timing benchmark and retrieved the performance of the SD card in the SD card reader. I then set the Pi boot order to “B2, which is USB Boot Boot from USB if available, otherwise boot from SD card”. I then shut down the RPi using the “shut down command and turned off the RPi. I removed the SD card and inserted into the SD to USB adapter that I use to burn SD cards, plugged it into the USB3 port, turned on the RPi and waited for about 1 to 2 minutes to see if the RPi would boot up, and it never did. I turned off the RPi and then removed the SD Card. I reinserted the SD card into the card reader on the RPi and turned on the RPi and it would not boot up. Luckily, I had a backup copy of the SD card that I tried and it booted up without a problem. Now, I have a SD card that does not boot, so I will have to reformat the SD card and install the Raspbian Buster light plus OMV5 again. Any idea what the problem is?

  10. Hi there,
    Like your tutorials.
    Is it possible to clone the SD card using commands in the terminal and not the SD Card Copier?
    I’m using an exisitng Pi OS Lite with NodeRED, Mosquitto and other stuff installed.

  11. I have watched a few of theses videos and I just bought the kit.. my goal is Cosmo Cosmic Crusader and Keen games.. here’s where I get lost in the very beginning.. is a second computer used for any of the install.. that’s where I get lost.. I downloaded the imager and extras and will be ready but I am worried I might screw up my second computer by trying to do something with it that I should be using the Pi for.. anyway.. thanks for the help..

Leave a Reply to Michael Garcia Cancel reply

Your email address will not be published. Required fields are marked *