Feature image for the article about how to fix for getting your SSD working via USB 3 on your Raspberry PI

Fix for getting your SSD working via USB 3 on your Raspberry PI

Did you connect an SSD to your Raspberry PI 4, with a SATA to USB 3.0 adapter, and getting poor read and write speeds? In theory this setup should yield significant speed improvements, making your Raspberry PI 4 system a worthy PC for your daily work. Unfortunately, some SATA to USB 3.0 adapters do not work that well in combination with your Raspberry PI 4. This article offers a fix for getting your SSD working via USB 3.0 on your Raspberry PI.

Background

With every new Raspberry PI model, the CPU gets faster and the RAM gets larger. The speed of the SD-card interface did unfortunately not really change over the years. Consequently, the SD-card read and write speed becomes more of a performance bottleneck. The SD-card is prone to corruption as well. Just ask someone who runs their Raspberry PI 24/7 as a server. You can solve this latter problem by moving the root file system to an external USB drive.

When connected to a USB 2.0 port, an external drive offers only marginal speed improvement over an SD-card. However, this all changes when you take the Raspberry PI 4 into consideration. The Raspberry PI 4 features two USB 3.0 ports. With the help of a SATA to USB 3.0 adapter, you can connect an SSD to your Raspberry PI 4. This results in significant read and write speed improvements.

Illustration of the system setup. It shows a Raspberry PI 4, an SSD and a SATA to USB 3.0 adapter.

While getting this setup working, you might run into an issue where your SSD drive does not seem to work properly. Read and write operations might be way slower than expected. Resulting in long boot times and overall poor and sluggish performance. It turns out that not all SATA to USB 3.0 adapters are compatible with the Rasberry PI 4. If you are in this situation, read on. I’ll present a fix for getting your SSD working via USB 3.0 on your Raspberry PI 4.

What do you need

This article assumes that you connected an SSD to your Raspberry PI 4’s USB 3.0 port, with the help of a SATA to USB 3.0 adapter. Furthermore, it assumes that you run into the before mentioned issue. The issue of not all SATA to USB 3.0 adapters being compatible with the Raspberry PI 4. Otherwise you probably wouldn’t be reading this article.

In ran into this issue myself with the following setup:

  • Raspberry PI 4 with 4 GB RAM
  • Samsung 860 EVO 250 GB SSD
  • Sabrent 2.5″ hard drive USB 3.0 enclosure (model EC-UASP)

I installed the Raspberry PI operating system, with the XFCE destop environment, on the SD-card. Afterwards, I moved the root file system to the SSD. Refer to the following PragmaticLinux tutorials for preparing a similar setup:

Fix 1 to get your USB 3.0 SSD working on your Raspberry PI 4

Connect your SSD, with SATA to USB 3.0 adapter, to a USB 2.0 port. So one of the black ones, instead of the blue ones. I admit that “fix” is a bit of a big word here. It probably gets your system working, but not at USB 3.0 speeds. Nonetheless, this gives us valuable diagnostic information. If everything seems to work via USB 2.0, then at least we know that USB 3.0 causes the problem. Once we confirmed this, we can continue with one of the other presented fixes.

If you still run into problems, when you connected your SSD to a USB 2.0 port, then USB 3.0 is not the root cause of the problem. Consequently, the other two fixes presented in this article will unfortunately not help you.

Fix 2 to get your USB 3.0 SSD working on your Raspberry PI 4

When you arrived at this point, you confirmed that USB 3.0 causes your problem. I recommend that you keep the SSD connected to a USB 2.0 port, while we make the fix. Before diving into the actual fix, let me offer a bit more background information of the problem’s root cause.

The USB 3.0 standard introduced the so called USB Attached SCSI Protocol (UASP). This communication protocol yields data throughput improvements for USB storage devices, including SSDs. Before UASP, the Bulk Only Transport (BOT) communication protocol was used. Depending on the implementation and application, UASP offers a 10-30% data throughput improvement over BOT. For this reason, SATA to USB 3.0 adapters support UASP. Note that they support BOT as well, for backward compatibility with USB 2.0.

The UASP support on your SATA to USB 3.0 adapter, unfortunately causes your problem. For some reason the Raspberry PI 4 does not work properly with the UASP implementation on all SATA to USB 3.0 adapters. Hopefully a software or firmware fix becomes available in the not too distant future.

In the mean time, you can disable UASP for USB 3.0, to fix the issue when connecting your SSD to your Raspberry PI 4. Your Raspberry PI 4 then falls back to the BOT communication protocol. We already know that BOT works from the previous section, where we connected to the USB 2.0 port. You’ll still get significant speed improvements compared to USB 2.0, just not that extra 10-30% that the UASP protocol could squeeze out.

Disable the USB Attached SCSI Protocol (UASP) on your Raspberry PI 4

To disable the USB Attached SCSI Protocol (UASP) on our Raspberry PI 4, we need to pass a specific command-line parameter to the Linux kernel. On your Raspberry PI’s boot partition, you can find a file called cmdline.txt. Its contents specify the command-line parameters passed to the Linux kernel, when it is loaded.

Essentially, we need to add the following line at the beginning of the cmdline.txt file:

  • usb-storage.quirks=[VID]:[PID]:u

We just need to replace the [VID] and [PID] parts with the USB Vendor and Product ID of our SATA to USB 3.0 adapter. This leads to the question: “How can I find the VID and PID of my SATA to USB 3.0 adapter”? Well, that’s the reason why I recommended you keep your SSD drive connected to a USB 2.0 port. You can run the following command from the terminal:

  • lsusb

This command lists information about all attached USB devices. You now need to figure out which one is your SATA to USB 3.0 adapter. Look for the keyword SATA in the output.

Terminal screenshot showing the output of the lsusb command. It highlights how to find the USB product identifier (PID) and vendor identifer (VID) of the SATA to USB 3.0 adapter.

As you can see in the screenshot above, my SATA to USB 3.0 adapter is the second one, listed in the output. Look at the values after ID for the VID and PID. In my case:

  • VID = 152d
  • PID = 1561

This means that to disable UASP for this USB device, I need to add the following kernel parameter:

  • usb-storage.quirks=152d:1561:u

You can add this kernel parameter, by editing the /boot/cmdline.txt file with the Nano editor :

  • sudo nano /boot/cmdline.txt

Add the kernel parameter at the start of the first line in this file and save the changes:

Terminal screenshot of editing /boot/cmdline.txt with Nano. The usb-storage.quirks Linux kernel command-line parameter is added as the start to disable UASP. This is needed to fix the problem with SSD on the Raspberry PI 4, connected to the USB 3 port.

Perform these steps to verify that the fix worked:

  1. Shut down your Raspberry PI 4.
  2. Attach your SSD drive to a USB 3.0 port (one of the blue ones).
  3. Power up your Raspberry PI 4.

Fix 3 to get your USB 3.0 SSD working on your Raspberry PI 4

The fix as described in the previous section works. However, it uses BOT instead of UASP as the communication protocol. Therefore you give up on 10-30% of data throughput. The ultimate fix to get your USB 3.0 SSD working on your Raspberry PI 4, is by purchasing a different SATA to USB 3.0 adapter. One the meets the following requirements:

  1. Supports the USB Attached SCSI Protocol (UASP or sometimes called UAS).
  2. Is compatible with your Raspberry PI 4.

Manufacturers list the UASP/UAS support on the box and on their product page. So the first requirements is easy to figure out. But how about the second one? How can we know which one is fully compatible with the Raspberry PI 4? Luckily, the community helps here. Have a look at this webpage. It provides an overview with those SATA to USB 3.0 adapters known to work with the Raspberry PI 4. Additionally, it lists those that do not work out-of-the-box.

This one looks like a good option:

  • The UGREEN 2.5″ SATA to USB-C 3.1 Enclosure Drive Caddy

Wrap up

The USB 3.0 standard introduced the USB Attached SCSI Protocol (UASP). It offers up to 30% read and write improvements over the Bulk Only Transport (BOT) communication protocol. Modern SATA to USB 3.0 adapters support UASP. Unfortunately, the Raspberry PI 4 does not (yet) offer compatibility with all these SATA to USB 3.0 adapters. Resulting in your connected SSD to not function at all or with poor performance.

This article presented three fixes for getting your SSD working on your Raspberry PI 4, in combination with a SATA to USB 3.0 adapter:

  1. Connect it to a USB 2.0 port.
  2. Add the usb-storage.quirks Linux kernel parameter to disable UASP and revert to BOT.
  3. Purchase a SATA to USB 3.0 adapter that supports UASP and is known to be compatible with your Raspberry PI 4.

Fix 1 is the easiest, but you do not take advantage of the USB 3.0 speed improvements. Fix 2 gives you USB 3.0 speeds, but using the slower BOT communication protocol. Fix number three is the preferred one, but requires you to purchase a new part.

PragmaticLinux

Long term Linux enthusiast, open source software developer and technical writer.

View all posts by PragmaticLinux →

2 thoughts on “Fix for getting your SSD working via USB 3 on your Raspberry PI

Comments are closed.