Guide

Raspberry Pi4 USB3.0 Storage Performance

The ability to boot from USB3.0 storage devices attached to the Raspberry Pi4 has been long anticipated. On 17 June 2020 the bootloader firmware moved from BETA to STABLE status, so I thought it was time to take a look at what this new capability can do for the Raspberry Pi SBC. Note, the firmware will need to be moved from stable to critical before it becomes part of the default Raspberry Pi OS updates. The firmware is stored on EEPROM on the Raspberry Pi 4, so if you do update the firmware, changing SD card won’t undo the change, you’ll need to reflash with rpi-eeprom-update.

There have been long-standing concerns around the use of SD card as primary storage on the Raspberry Pi, indeed from my own personal experience SD cards can and do fail and I’ve lost more than one in my various Raspberry Pi projects. Whilst you’ve been able to add secondary storage via USB, booting from an attached mass storage device hasn’t been possible until these more recent firmware developments. Being able to use more reliable and faster storage is a significant step forward for the platform.

I’d love to see an M.2 connector on a future Raspberry Pi, so that modern M.2 SSD storage devices could be directly on the board without additional bulky USB to SATA adapters.

Testing

Whilst reliability is something that moving away from micro SD cards brings, testing this isn’t really practical, so instead I’m focusing on the performance gains expected from being able to use USB 3.0 mass storage devices. Performance is assessed using:

  • Storage performance throughout tests using microsd-benchmarks.sh from pidramble.com benchmarking tests.
    • dd to write 50,000 8k blocks ~ 400MB. This is a simple sequential read/write test, of a sufficient size that the OS won’t just cache the data but will write it out to the storage device
    • iozone (version 3.434) 4k random read/write. This small block size represents common operations such as logging and database actions.
    • Note: The above tests are run 3 times and the results averaged
  • Time-based measurements for:
    • Rebooting the Raspberry Pi from within a desktop session, until the desktop (3440×1440) is loaded and the wastebasket is shown.
      • Pi is connected to WiFi and Ethernet. It also has SSH and VNC enabled.
    • Application load times for:
      • Chromium
      • LibreOffice Calc
      • LibreOffice Impress
    • Compilation of Linux kernel image make -j4 zImage modules dtbs

Initial tests with the MicroSD Card are performed with the current release firmware, then repeated with the new STABLE bootloader firmware, ahead of testing USB 3 mass storage boot devices. The contents of the SD card were copied to the USB flash drive and SSD using the SD Card Copier utility on the Raspberry Pi Desktop.

Once the bootloader is updated the Pi will boot from a USB device first, it present. But to ensure the SD card wasn’t being used in error it was removed whilst testing the USB connected storage.

Test Devices

As can be seen from the extensive results collated on the Raspberry Pi Dramble microSD Card Benchmark page, microSD card performance is very variable even across devices in the same class. USB 3.0 flash drives (USB thumb drives, or whatever you want to call them) similarly vary significantly in performance. To establish the performance and select the best device for testing the devices were initially performance tested on my Windows PC using CrystalDiskMark 64bit with 1 GiB test file. Note, I didn’t buy any new devices for this testing, it was just what I had to hand.

Testing the performance of the Samsung SSD I had available using a USB to SATA adapter showed significantly higher performance than any of the USB flash drives.

The following devices were selected for the tests:

  • MicroSD: Samsung Pro Plus 32GB
  • USB3 Flash Drive: SanDisk Extreme USB 3.0 16GB
  • USB to SATA Adapter: Sabrent USB 3.1 to SATA
  • SSD: Samsung 120GB (MZ-7PA1280/0D1) – This is a fairly old SSD

Results

Release firmware: a5e1b95f320810c69441557c5f5f0a7f2460dfb8 (Apr 16 2020 18:11:26)
Stable firmware: c302dea096cc79f102cec12aeeb51abf392bd781 (Jun 15 2020 14:36:19)

Test: dd write 50,000 8k blocks

Test: iozone

Test: Raspberry Pi 4 Reboot Time

Test: Application Start Time

Test: Compile Kernel Image Time

Conclusions

  • The new STABLE firmware (15 June 2020) performs the same (within the margin of error) as the current Release bootloader firmware (16 April 2020)
  • USB3 connected devices provide access to greater storage performance should you need it.
  • First time activities, such as application load, compiling the kernel can benefit from the improved performance of USB3 storage devices. However subsequent repeated activity doesn’t benefit, due to file system caching.
  • Whilst other post and videos I’ve seen indicate no change in booting performance, my reboot testing did show a significant gain, with times reduced by around 10 seconds.
  • If the workload on your Raspberry Pi performs heavy random read/write IO then this is where access to fast SSD storage can really bring some benefits.
  • HIgher performance might be available with the latest USB flash drives and SSD, but the gains provided with even quite old storage can clearly be seen.

Parts Tested

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.