Raspberry Pi 4 USB Boot Config Guide for SSD / Flash Drives

Raspberry Pi 4 with Samsung 950 Pro NVME SSD
Raspberry Pi 4 with Samsung 950 Pro NVME SSD

The Raspberry Pi 4 is finally here and has a lot of exciting changes. One very major downside is that it doesn’t support true USB booting yet out of the box (like the 3 series did). The Raspberry Pi foundation states that it is being worked on and will be added back with a future update. No timeline has been given yet for that to happen but they state it’s one of their top priorities.

Most of my projects heavily depend on having good performing storage so sitting and waiting was not an acceptable solution. In this guide I’ll show you a workaround to use USB devices as your rootfs device and use a Micro SD card as bootloader only which gives us full SSD performance after boot! To see exactly how much of a performance difference this makes (spoiler: it’s gigantic) check out the Raspberry Pi Storage Benchmarks.

I highly recommend doing this on a completely new install. If you try to upgrade your old ones and something goes wrong there’s a good chance you might lose data. We will be modifying the boot partition, resizing partitions, etc. so don’t use a drive with any data on it unless you are positive you have all of the steps down!

Compatible USB 3.0 Adapters

The Raspberry Pi 4 is proving to be picky about what SATA, M.2, etc. adapters will work in the USB 3.0 port. The USB 3.0 ports are the ones in the middle that are blue inside. The black ones are USB 2.0 and won’t give you the faster speeds the new Pi offers.

It’s very likely that some of these will be fixed via software and firmware updates and the Raspberry Pi Foundation has several open known issues related to USB 3. Until that happens though I will maintain a list here of known working ones and known problematic ones. It’s still very early in the release of the Pi 4 so we still have a lot to learn about which adapters work / don’t work. If you have working and nonworking adapters leave a comment and I’ll add it in this list.

If the adapters worked before on older Pis then one thing you can try is putting them in the black USB 2.0 ports. Obviously this is stupid because we all want the Pi 4 performance gains but if you end up needing to buy a new adapter this will give you a workaround until a replacement arrives!

Find USB adapter chipset

There are certain chipsets used in adapters that are known to be working/not working.

pi@raspberrypi:~ $ lsusb
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. Name: ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

This is a lsusb dump of all my connected USB devices. I have bolded the line with the USB bridge device. We can see that the chipset is ASM1153E

Known Good Chipsets

  • ASMedia ASM115X (StarTech 2.5″ SATA)

Known Working Adapters

2.5″ SATA

StarTech.com 2.5″ SATA to USB Cable

Confirmed working by dzm in the comments

ELUTENG 2.5″ SATA to USB 3.0

The ELUTENG is one of the known working 2.5″ SATA to USB 3.0 adapters for the Pi 4.

CSL SL – USB 3.0 auf SATA Adapter

The CSL SL adapter is confirmed to be working by Krikitt in the comments. Might not be available in the US.

M.2 Adapters

Shinestar M.2 NVME to USB Adapter

This is the adapter I’m using in the picture at the top of the article. It is for NVME M.2 drives.

QNINE M.2 SATA to USB Adapter

I used this adapter to benchmark M.2 SATA Lite-On and SanDisk drives — working great in 3.0 ports.

mSATA

Tanbin mSATA Micro SATA to USB Adapter

I used this mSATA to USB adapter for my Crucial M550 benchmark — working in 3.0 ports.

fe2008 mSATA to USB 3.0 Adapter

Confirmed working in comments by Nico

Power Adapters

Canakit USB-C Raspberry Pi 4 Power Supply

Known Problematic Adapters

USB Boot Instructions

  1. Prepare Bootloader SD Card – Image your SD card with the latest Raspbian 10 “Buster” release (I prefer Raspbian Lite) however you would normally do it.
  2. Prepare SSD / Flash Drive – Image your SSD or Flash Drive. Make sure you create the empty file named “ssh” on the boot partition of both drives.
  3. Boot / Update Raspberry Pi – Start up your Raspberry Pi with only the SD card in the slot. After the Pi boots to plug in your SSD / Flash drive.
    Type “sudo apt-get update && sudo apt-get dist-upgrade” to update the system and firmware.
  4. Run sudo blkid – With your SSD / Flash drive plugged in type the command “sudo blkid” (example below)
  5. Identify drive – Your list will contain /dev/mmcblk0p1 and 2 (SD card) and your SSD / Flash drive (usually/dev/sda1 and 2).
    We are looking for the PARTUUID of your flash / SSD drive’s second partition (rootfs). This will end with -02. Here is an example:
    /dev/sda2: LABEL=”rootfs” UUID=”638417fb-7220-47b1-883c-e6fee02f51ac” TYPE=”ext4″ PARTUUID=”0634f60c-02″
    Save or white a note somewhere of the values for both drives. We will use both PARTUUIDs for /dev/sda* and dev/mmcblk* later.
  6. Edit /boot/cmdline.txt – First make a backup by typing: sudo cp /boot/cmdline.txt /boot/cmdline.txt.bak
    Now type “sudo nano /boot/cmdline.txt” – Change your boot command to load the partition from the SSD / Flash drive instead of your SD card.
    Before: dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=af1800e7-01 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
    After: dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=0634f60c-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
  7. Reboot Pi – If your Pi won’t boot put your micro SD into a computer and restore /boot/cmdline.txt.bak to get back into the Pi.
    Note: the first boot with your SSD / Flash drive will be slow the first time as it runs fsck on the drive and other first boot configuration.
    It can take over a minute or two sometimes for really big drives so give it a little bit of time here before assuming it didn’t work
  8. Update fstab – Change /etc/fstab entry for /boot to point to the SD card to ensure that firmware and bootloader updates retrieved — detailed example/instructions in section below
  9. Resize file system – Upon first startup the size of your root (/) filesystem partition will only be 1.8G no matter how big your drive is — see section below for detailed example/instructions

Your system will now be running completely from your USB drive! To verify this, run the command “findmnt -n -o SOURCE” / to ensure your root partition has switched over as shown below to /dev/sda2 instead of /dev/mmcblk0p2.

pi@raspberrypi:~ $ findmnt -n -o SOURCE /
/dev/sda2

Updating fstab

Right now your fstab file on the USB drive is automounting the /boot/ partition from the USB drive even though it isn’t being used. We need to update this to your SD card so that firmware/bootloader updates are actually utilized.

The current file will look similar to this:

cat /etc/fstab
proc                  /proc           proc    defaults          0       0
PARTUUID=0634f60c-01  /boot           vfat    defaults          0       2
PARTUUID=0634f60c-02  /               ext4    defaults,noatime  0       1

We want to change the /boot partition (ending with -01 to load our SD cards PARTUUID instead of the USB drive. After making the change my /etc/fstab file looks like this:

proc                  /proc           proc    defaults          0       0
PARTUUID=af1800e7-01  /boot           vfat    defaults          0       2
PARTUUID=0634f60c-02  /               ext4    defaults,noatime  0       1

Make sure the SD card and new drive both have a blank “ssh” file if you want to keep SSH enabled. Switching bootloaders will often work fine but if you forget this step you’ll try to connect to your Pi and think it’s down when really it just isn’t listening for SSH after changing the bootloader without recreating it.

ot. After reboot typing: “df -H” should show /boot/ as being the SD card again (mmcblk0). Now we can be sure that any updates to the /boot/ partition from apt-get are applying to our system.

Resizing Filesystem

By default the partition on the SSD / Flash drive will only be 1.8G. The Pi expands this automatically on micro SD drives but we will need to do it ourselves for a SSD / Flash drive. To do this we need to expand the partition and then resize the file system.

First let’s open fdisk and print the partitions:

pi@raspberrypi:~ $ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): p

Disk /dev/sda: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Disk model: 2115
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 33553920 bytes
Disklabel type: dos
Disk identifier: 0x0634f60c
Device     Boot  Start     End Sectors  Size Id Type
/dev/sda1         8192  532480  524289  256M  c W95 FAT32 (LBA)
/dev/sda2       540672 4292607 3751936  1.8G 83 Linux

There is the line we need. Our start value for /dev/sda2 (rootfs) is 540672. Next we need to remove and recreate the partition as a larger size. If you make any mistakes during this command just close fdisk by pressing q. The changes won’t be written to disk. If you mess up any of the commands the drive will no longer boot and you’ll have to start over again so be careful!

Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 has been deleted.
Command (m for help): n
Partition type
    p   primary (1 primary, 0 extended, 3 free)
    e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (532481-500118191, default 589815): 540672 (enter the start value exactly as it was, the default will be wrong)
Last sector, +/-sectors or +/-size{K,M,G,T,P} (540672-500118191, default 500118191): (press enter to accept default which is the full disk)
Created a new partition 2 of type 'Linux' and of size 238.2 GiB.
Partition #2 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: n (don't remove signature)

If everything went well then type “w” and press enter. Otherwise press “q” to quit and try again. Once you enter “w” the changes will be permanently written to disk!

Now reboot the system. Type “df -h” to view the current disk:

pi@raspberrypi:~ $ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.8G  1.2G  450M  73% /
devtmpfs        866M     0  866M   0% /dev
tmpfs           995M     0  995M   0% /dev/shm
tmpfs           995M  8.4M  987M   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           995M     0  995M   0% /sys/fs/cgroup
/dev/sda1       253M   40M  213M  16% /boot
tmpfs           199M     0  199M   0% /run/user/1000

We can see our disk is still 1.8G even after resizing the partition. That’s because we still have one more step! We need to resize the filesystem to fill our new partition space. For this we will use “sudo resize2fs /dev/sda2”:

sudo resize2fs /dev/sda2
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/sda2 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 15
The filesystem on /dev/sda2 is now 62447190 (4k) blocks long.

Now let’s check df -h again:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       235G  1.2G  224G   1% /
devtmpfs        866M     0  866M   0% /dev
tmpfs           995M     0  995M   0% /dev/shm
tmpfs           995M  8.4M  987M   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           995M     0  995M   0% /sys/fs/cgroup
/dev/sda1       253M   40M  213M  16% /boot
tmpfs           199M     0  199M   0% /run/user/1000

And that’s it! You will now be using all of your space on your SSD / Flash drive.

Conclusion

The Samsung 950 Pro NVME drive in the featured picture scored a 9189 on the Raspberry Pi Storage Benchmark. The previous all-time record score on a Pi 3B+ was 3561. The performance gains are very real and very dramatic.

For me getting this performance is well worth having to waste a micro SD card just to be a bootloader. I am largely after the USB 3.0 bus and gigabit ethernet performance improvements and using this method I am able to achieve the performance I was after without waiting an indeterminate amount of time for the feature to be added back in!

Although there are ongoing compatibility issues and we lack the super easy native USB booting support we had before I’m more than willing to go through the growing pains to finally get rid that ancient USB 2.0 bus! Just make sure if you are planning to build a system you plan your adapters and parts accordingly.

47 thoughts on “Raspberry Pi 4 USB Boot Config Guide for SSD / Flash Drives”

  1. Avatar for Wim

    I also encounter the problem of a frozen mouse and keyboard.
    It realy was switched over to the SSD.
    I also run the PI4.
    Is there a solution around? I did not get it.
    Wim

  2. Avatar for Thomas

    I bought some no name USB 3.0 adapter and it turned out to be a JMicron one:
    “`
    $ lsusb
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 002: ID 152d:0578 JMicron Technology Corp. / JMicron USA Technology Corp. JMS567 SATA 6Gb/s bridge
    “`

    So… as the result, it didn’t work with USB 3.0 ports but it worked with USB 2.0 ports. However with the MARKUS’ help and the article (https://www.raspberrypi.org/forums/viewtopic.php?t=245931) with `usb-storage.quirks` option for /boot/cmdline.txt` I managed to run my drive successfully with USB 3.0 ports!!!

    Some of you might be curious about the performance and it’s quite good actually, take a look:
    “`
    $ sudo dd if=/dev/zero of=/mnt/test bs=8k count=500k conv=fsync
    512000+0 records in
    512000+0 records out
    4194304000 bytes (4.2 GB, 3.9 GiB) copied, 18.2822 s, 229 MB/s
    “`

    I hope it will help somebody 🙂

  3. Avatar for Markus

    Thanks for this post! I had given up on using my Samsung SSD 830 on any of my Pi’s.

    Now it runs fine as a mounted (non-boot) drive (and on a Pi 4 also fast)!

    Adapter “Sabrent 2.5” was already mentioned:
    Bus 002 Device 002: ID 152d:1561 JMicron Technology Corp. / JMicron USA Technology Corp. JMS561U two ports SATA 6Gb/s bridge

    [ 983.399574] usb 2-2: new SuperSpeed Gen 1 USB device number 6 using xhci_hcd
    [ 983.430625] usb 2-2: New USB device found, idVendor=152d, idProduct=1561, bcdDevice= 2.04
    [ 983.430640] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [ 983.430652] usb 2-2: Product: SABRENT
    [ 983.430664] usb 2-2: Manufacturer: SABRENT

    As I had no clue, how to add a “quirk”, that thread helped me:
    https://www.raspberrypi.org/forums/viewtopic.php?t=245931

    1. Avatar for Markus

      Using the quirk I was able to boot from the SABRENT adapter via USB 3.0!!!

      pi@raspberrypi:/ $ cat /boot/cmdline.txt
      usb-storage.quirks=152d:1561:u dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=17869b7d-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

      /dev/sda2 on / type ext4 (rw,noatime)
      /dev/sda1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)

      /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
      |__ Port 2: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M

      [ 0.971855] usb 2-2: new SuperSpeed Gen 1 USB device number 2 using xhci_hcd
      [ 1.022202] usb 2-2: New USB device found, idVendor=152d, idProduct=1561, bcdDevice= 2.04
      [ 1.022235] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
      [ 1.022262] usb 2-2: Product: SABRENT
      [ 1.022284] usb 2-2: Manufacturer: SABRENT
      [ 1.022306] usb 2-2: SerialNumber:
      [ 1.024969] usb 2-2: UAS is blacklisted for this device, using usb-storage instead
      [ 1.025080] usb 2-2: UAS is blacklisted for this device, using usb-storage instead

      1. Avatar for Ilhan

        Yes the quirk also made my boot work with a Jmicron controller and a kingston A400.
        Thanks for posting this and thanks James for the awesome guide

  4. Avatar for Gumby2

    I’m using the startech.com adapter with the ASM1153E chipset and it didn’t work until I disabled UAS. Drive is samsung ST1000LM025 and connected directly to pi USB 3 port.

    pi@raspberrypi4:~ $ lsusb
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 002: ID 174c:55aa ASMedia Technology Inc. Name: ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge, ASM1153E SATA 6Gb/s bridge

  5. Avatar for edf

    Hi James,
    Thanks a lot for this detailed procedure.
    I encountered the following problem after installing the full Raspbian, with HDMI display and keyboard, following your procedure:
    the boot ended on the desktop but with a frozen keyboard and mouse (also a message on the boot log about not being able to load the kernel).
    I think (just a supposition as I am new to linux) that the upgraded boot partition on the SD card is not compatible with the (not yet upgraded) root partition of the SSD.
    Solution was to postpone update/upgrade as the last step in the process so that the boot (on the SD card) and the Root (on the SSD) are updated/upgraded together.
    [Consequently you cannot boot on the SD card alone as the boot and root on the SD card are not in sync: indeed if the cmdline.txt file is modified again to point to the SD card root partition, you get the same failure at boot – frozen keyboard and mouse. The SD card would need to be re-flashed and updated/upgraded; then you should be able to boot either with the SD card root or with the SSD root depending on the content of the cmdline.txt].

    I used a Western Digital GREEN M.2 2280 SSD 120GB in an ADWITS USB adaptor and box (model LM-711M). It seems to work fine from the PI 4 USB 3 port (no hub). Overal score from your tests is 6163.
    I also tried a Kingston USB 3 flash (DT microDuo 3C) with poor results (very very slow).

    1. Avatar for jamesachambers
      jamesachambers

      Hey edf,

      Thanks for the feedback! You’re definitely right that the /boot/ partition with the old firmware lacking Raspberry Pi 4 support is the problem.

      Very nice scores on the benchmark! The M.2 solid state drives continue to dominate the charts. The flash drive is not a surprise. Very few of them that have been tested have outperformed an even average SSD.

  6. Avatar for Mark L

    A good but old 2.5″ adapter to report – Mediasonic HD3-SU3-BK: https://www.amazon.com/Mediasonic-2-5-Inch-External-Enclosure-HD3-SU3-BK/dp/B003YFHE9I

    ID 2109:0700 VIA Labs, Inc. VL700 SATA 3Gb/s bridge

    With an old SanDisk “regular” 64 GB SSD:

    sudo dd if=/dev/zero of=~/test bs=8k count=500k conv=fsync
    512000+0 records in
    512000+0 records out
    4194304000 bytes (4.2 GB, 3.9 GiB) copied, 26.4779 s, 158 MB/s

    pi@RPi4:~ $ sudo dd if=~/test of=/dev/null bs=8k count=500k
    512000+0 records in
    512000+0 records out
    4194304000 bytes (4.2 GB, 3.9 GiB) copied, 22.9208 s, 183 MB/s

    Not bad.

    Also got an otherwise very nice USB 3.0 “stick” for a 2242 M.2 SSD with a very cheap SSD that benches surprisingly fast on Linux Mint but unfortunately has the JMicron controller IC which causes very erratic behaviour on the Pi4. Will have to do the USB quirks workaround and report back.

    1. Avatar for Mark L

      With the USB quirk set, I can boot with the new adapter inserted. However I get very strange behaviour if I insert the drive after boot – it always crashes LXDE. If I try to boot from it, everything seems to work but all USB ports get disabled so I have no keyboard or mouse and none get detected. Weird!

      What’s more, my PARTUUIDs from my previous USB SSD and this new one are the same?

      Anyway, running off my previous SSD, I did get some so-so benchmarks, a little better than the previous one I guess:

      sudo dd if=/dev/zero of=/dev/sdb2 bs=8k count=500k conv=fsync
      512000+0 records in
      512000+0 records out
      4194304000 bytes (4.2 GB, 3.9 GiB) copied, 29.1563 s, 144 MB/s
      pi@RPi4:~ $ sudo dd if=/dev/sdb2 of=/dev/null bs=8k count=500k
      512000+0 records in
      512000+0 records out
      4194304000 bytes (4.2 GB, 3.9 GiB) copied, 14.8941 s, 282 MB/s

      This is too unstable to boot from though, and it’s a shame.

      1. Avatar for jamesachambers

        Hey Mark,

        Thanks for the feedback and updates! I know the SD driver is undergoing a rework right now and I’m sure other drivers will be tweaked to avoid all these types of behavior over the next couple of months.

  7. Avatar for Jarkko

    I have one adapter usb3-ssd which is working but while using it, bluetooth coverage will drop dramatically. Have you faced similar issues?

    Second usb3-ssd adapter will not work at all, only if connected to usb2

  8. Avatar for Scott Vincent

    I also bought the Sabrent cable and got really poor performance, approx 35 MB/sec. Have just replaced it with this cable from Amazon UK which uses the ASM1153 chipset and can confirm I am now getting the following:

    pi@raspberrypi:~ $ sudo dd if=/dev/zero of=/root/test bs=8k count=500k conv=fsync
    512000+0 records in
    512000+0 records out
    4194304000 bytes (4.2 GB, 3.9 GiB) copied, 17.8797 s, 235 MB/s

    1. Avatar for MikeB

      Adding the appropriate quirk (which disables UAS) works well on all my problematic USB 3 sata adapters
      e,g.
      sudo dd if=/dev/zero of=/root/test bs=8k count=500k conv=fsync
      512000+0 records in
      512000+0 records out
      4194304000 bytes (4.2 GB, 3.9 GiB) copied, 18.2161 s, 230 MB/s

      sudo hdparm -tT /dev/sda1

      /dev/sda1:
      Timing cached reads: 1822 MB in 2.00 seconds = 911.46 MB/sec
      Timing buffered disk reads: 876 MB in 3.00 seconds = 291.86 MB/sec

    2. Avatar for krikk

      dding the appropriate quirk (which disables UAS) works well also with:
      Sabrent USB 3.0 to 2.5″ SATA adapter

      root@raspi4:~# lsusb
      Bus 002 Device 002: ID 152d:1561 JMicron Technology Corp. / JMicron USA Technology Corp. JMS561U two ports SATA 6Gb/s bridge

      performance seems to be not affected in my case:

      root@raspi4:~# sudo dd if=/dev/zero of=/root/test bs=8k count=500k conv=fsync
      512000+0 records in
      512000+0 records out
      4194304000 bytes (4.2 GB, 3.9 GiB) copied, 25.4552 s, 165 MB/s

      same result as with my other adapter (need to get a faster ssd 🙂

Leave a Comment

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

Type here..