Just got an Orange Pi 5. I couldn’t find a simple set of instructions on how to boot it off the M.2 NVMe slot, so I’m documenting it here.

Background

I didn’t find simple instructions for getting the Orange Pi 5 to boot off of NVMe. It’s not difficult, just not documented in one place that I could find.

Parts List

  • An Orange Pi 5. I got a 16GB one from Amazon for $149
  • A microSD card. I used a Sandisk 32GB card because they’re reliable, quick, and cost effective. You don’t need something that fast or reliable, you’re only going to use it long enough for imaging.
  • An NVMe drive. If you want it to fit neatly without sticking out from under the Orange Pi, you need a 2230 or 2242 form factor card. I got a SAMSUNG 512GB M.2 2242 model MZALQ512HALU) for $49.
  • Unfortunately the Orange Pi 5 doesn’t come with an M.2 mounting screw, so I bought a bag full from Amazon for $5.97

Instructions

Preparatiion

  1. Download Joshua Riek’s ubuntu build from Joshua-Riek/ubuntu-orange-pi5. Here’s a direct link to the releases. I used
  2. Burn it to a microSD card. I use Balena Ether because I can use it on my Mac or Linux boxes, and it validates the results automatically for you.
  3. Install the NVMe drive.

Update the SPI firmware

  1. Boot with the microSD card. I didn’t bother to do any more configuration than it forced me to since I knew I was going to have to do it again after switching to the NVMe drive
  2. Flash the SPI bootloader by running sudo dd if=/lib/u-boot-orangepi-rk3588/rkspi_loader.img of=/dev/mtdblock0 conv=notrunc

Prep the NVMe drive

  1. Run sudo lsblk to see what devices the drives on your machine are recognized as. It should be easy to tell them apart by their size. On my machine, the NVMe drive was /dev/nvme0n1 and my microSD card was /dev/mmcblk1.
  2. This step will nuke any data on the NVMe drive and it will be difficult to retrieve the data if it’s even possible at all. sudo cat /dev/mmcblk1 > /dev/nvme0n1. It won’t print anything, and may take 20-30 minutes depending on the size of your drive. Be patient.

Once you’re done, shut down the system with sudo shutdown -h now, remove the microSD card and reboot.

The first boot from NVMe may take a few minutes - Joshua’s ubuntu build is automagically extending the filesystem to consume the entire NVMe drive.

Benchmarks

I ran the storage benchmark from PiBenchmarks.

     Category                  Test                      Result
HDParm                    Disk Read                 367.77 MB/s
HDParm                    Cached Disk Read          362.99 MB/s
DD                        Disk Write                232 MB/s
FIO                       4k random read            87521 IOPS (350085 KB/s)
FIO                       4k random write           40235 IOPS (160943 KB/s)
IOZone                    4k read                   72318 KB/s
IOZone                    4k write                  105149 KB/s
IOZone                    4k random read            38021 KB/s
IOZone                    4k random write           69923 KB/s

                          Score: 20187

For comparison, when I ran it on my Odroid N2 with a USB 3.0 SSD, the Odroid wasn’t just embarrassed, it was humiliated. M.2 for the win!


     Category                  Test                      Result
HDParm                    Disk Read                 237.62 MB/s
HDParm                    Cached Disk Read          133.27 MB/s
DD                        Disk Write                20.4 MB/s
FIO                       4k random read            5017 IOPS (20068 KB/s)
FIO                       4k random write           2258 IOPS (9034 KB/s)
IOZone                    4k read                   36002 KB/s
IOZone                    4k write                  8283 KB/s
IOZone                    4k random read            14312 KB/s
IOZone                    4k random write           7929 KB/s

                          Score: 2443

Update: For the curious, here’s the uname output: Linux medusa.example.com 5.10.110-rockchip-rk3588 #1 SMP Wed Mar 29 08:28:12 BST 2023 aarch64 aarch64 aarch64 GNU/Linux