Hardware: Raspberry Pi 4 Boot Disk Optimization

I recently looked at my 2008 Mac Pro to optimize it's startup disk; today let's have a look at the Raspberry Pi 4 to see what kind of setup provides the fastest read speed on it's boot disk. We can take it for granted that the Pi 4's USB3 port will provide better throughput than the on-board microSD reader; I've seen people using different USB3 peripherals for their boot disks, though. Today, I'll have a look at how a USB3 flash drive performs against a 2.5" solid state.

Quick Background

I previously posted on the feasibility of the Raspberry Pi 4 as a desktop computer--particularly in regard to whether it could handle my web-development workflow; there are really three major issues at stake with regard to whether the Pi 4 can pull it off:

  1. Software options for the ARM architecture (fewer than for x86)
  2. Processor speed (the processor can be overclocked to around 2Ghz)
  3. Disk read speed (microSD reader under performs next to USB3)

Getting a grip on #3 here is pretty important to my stated goal of using the Pi 4 as a desktop computer. It shouldn't be too hard to get some benchmarks on read speed, and thanks to my recent post on benchmarking my 2008 Mac Pro, I've got some good data on other devices (older and newer) which will provide some good context for the Pi 4's performance. I'll look at both a USB3 64Gb Flash Drive as well as a OWC 2.5" Mercury Electra 6G 120Gb drive (connected with a SATA to USB3 adapter).

Off to The Races: Establishing a Baseline

Let's start by benchmarking the on board microSD card. That'll give us a good point of reference to see how much better USB3 devices perform. If you didn't catch my post on benchmarking the Mac Pro, we'll be using hdparm again to give us read speeds. Ideally, we'd run hdparm a few times on the same disk to get a good average for read speed. I've seen read speeds vary by a few MB/sec, but nothing enough to warrant rigorous testing, here. Whatever bench marks we get here we'll just take them as general indicators of read speed. As with my previous post, we'll use the -t and -T options to output both cached and buffered read times. On your Pi 4, you should be able to get the path to your microSD boot disk with fdisk -l--although, the path should usually be /dev/mmcblk0 I think.

microSD benchmark
As far as invalid arguments go, this one seems pretty harmless... PS: forgive the fuzziness of this screen grab--I don't have a dedicated monitor for my Pi 4, so I often connect to it with a VNC client; one of the cool features of Raspberry Pi OS is built in VNC server support.

A-b-y-s-m-a-l... is the word--I believe. The cached read isn't bad, all things considered; but, the buffered read time of 43.47MB/sec is pretty awful. This number isn't too surprising, though, particularly if you've already been using the microSD slot to boot any of the weightier OS'es for the Pi 4: Raspberry Pi OS, Kali Linux, Ubuntu MATE, etc. Heavier OS'es don't feel particularly nimble on the Pi 4. In my initial testing, the lagginess of the OS'es didn't instill confidence in using the Pi 4 as a desktop computer. The ability to overclock the processor didn't seem to impact the performance in any "considerable" way, either.

(As a side note: you can effectively double the buffered read speed to around 89MB/sec by simply moving the microSD card to a USB3 microSD reader. I won't go into depth here, I just thought I'd add the number for context. This will still underperform next to the other options covered herein.)

Getting the Flash Drive Ready

I could get a read speed on the USB flash drive without much effort, but in my case I'm looking at moving to the USB 3 port for a startup disk either way. Before testing read speed I'll go ahead and flash the drive with Raspberry Pi OS; it's nice to have numbers, but sometimes you want to literally "feel" the speed (i.e., boot time, responsiveness of the OS, etc.). To do this, I grabbed the most recent image of Raspberry Pi OS from the Pi Foundation and used balenaEtcher to flash it to the drive.

belena etcher to flash usb flash disk
balena has some really cool projects... I may have to look into their solution for deploying a minecraft server. My kids would go crazy!

I took a second, also to flash my 2.5" drive, and with those out of the way moved on to benchmarking the USB flash drive. Again, use fdisk -l if you need to find paths. Here's what I get on the flash drive:

benchmarking the flash drive on r-pi 4
A big improvement! Still not sure why I'm getting these IO erros--this error seemed to go away when I used the drive as a boot disk...

This is about 3 times as fast as the microSD read time--at least on buffered reads. This is pretty good. Booting into the OS didn't feel all that much faster than the microSD, though. If there was a notable difference in the nimbleness of the OS, I didn't really pick up on it. That may be, however, because after seeing a 3x improvement, my mind was now racing to see what the speed would be on the 2.5" solid state. With that said, let's see how the SSD performed:

benchmarking the 2.5 inch solid state on r-pi 4
That's what we like to see!

Hey! Now that's a respectable number for an SBC that retails for about 85$! The buffered speed here is almost 8 times better compared to the microSD! This instills a bit more confidence--and I can tell you that after booting, the difference in performance is notable! The OS "flies" by comparison. Still, let's not get too far ahead of ourselves. It's important to keep things in context.

In my other post, I was able to get read speeds on two other computers: a 2008 Mac Pro and a 2019 ThinkPad E570. For full details on the variables involved in those benchmarks, I'd invite you again to read that post. I won't pull in all the numbers here, but there are a few different setups that provide context for the Pi 4. Firstly, let's look at the best performing benchmarks from the Mac Pro and the ThinkPad alongside the Pi 4 (in order of performance):

  • 2019 ThinkPad:
    • 1411.16 MB/sec buffered (nvme)
  • 2008 Mac Pro:
    • 499.18 MB/sec buffered (2.5" SSD on 16x PCIe 2.0)
  • Pi 4:
    • 332.57 MB/sec buffered (2.5" SSD on USB3)

These benchmarks provide some good context for the Pi 4, but they aren't really an apples to apples comparison. The hardware profiles are just too far apart for these numbers to be fully meaningful. It shouldn't be surprising that the Pi 4 under performs next to a ThinkPad or a legacy Mac Pro (for 2008, the Mac Pro was a bad ass mofo). Another helpful comparison might be the SATA bays in both the ThinkPad and the Mac Pro. Let's see what those numbers look like (again, in order of performance):

  • 2019 ThinkPad:
    • 468.91 MB/sec buffered (2.5" SSD on SATA)
  • Pi 4:
    • 332.57 MB/sec buffered (2.5" SSD on USB 3)
  • 2008 Mac Pro:
    • 265.21 MB/sec buffered (2.5" SSD on SATA)

Here, the Pi 4 sits more or less in the middle. It probably under performs next to most modern computers, but it doesn't perform so poorly you would discount as a "competitive"; my 2008 Mac Pro is still competitive with my ThinkPad; the Pi 4 is definitely competitive with lower end laptops and bargain desktops that begin at higher price points. I'd reassert that the performance when booting with the 2.5" SSD is enough to keep the Pi 4 in the game: it may actually be capable of handling a desktop web-development work-flow. It's also worth noting that the throughput on USB3 should be about 600MB on the high end; there may be other hard drive setups that deliver even better performance (mSATA, M2, etc.). There's still a lot to be tested. I've overclocked the unit successfully before; I'll want to do it again with the new HD setup. I've also recently installed XFCE over Raspberry Pi OS. This is a "lightweight" desktop manager, but probably a little bulkier than the native Pi OS manager. The real question in my mind still remains whether I can get the tools I need with the ARM architecture.

Interesting stuff...