Orange Pi 5 NVMe/SATA SSD Boot Guide

Orange Pi 5 with Heat Sinks
Orange Pi 5 NVMe / SSD Boot Guide

The Orange Pi 5 has a nice M.2 NVMe slot but unfortunately most of the official images will not boot if you try to directly image a NVMe drive. Fortunately there is an easy way to get this working that people who frequent the blog will almost certainly have seen before.

We are going to bootstrap the boot process using a SD card and then clone that SD card to our SSD to be used as the root partition. This essentially will let us have our system’s root partition on the SSD (much faster).

Let’s get started!

Hardware Used

Orange Pi 5 - Top View
Orange Pi 5

The Orange Pi 5 the latest release from Orange Pi and is the most powerful model yet. It has a 6 core CPU and options from 4GB of RAM all the way up to 32GB of RAM!

Links: Amazon.com*, AliExpress*, Amazon.ca*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*

Kioxia 2230 M2 NVMe Drive
Kioxia 2230 M2 NVMe Drive

The Kioxia (Toshiba) 128GB M.2 2230 PCIe NVMe drive is much shorter than most NVMe drives (full size is 2280). It fits great with single board computers / tablets / other smaller form factors.

Links: Amazon.com*, Amazon.ca*, Amazon.co.uk*, Amazon.co.jp*, Amazon.com.au*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*, Amazon.sg*

Geekworm Copper Heat Sink Set
Geekworm Copper Heat Sink Set

The Geekworm copper heat sink set is designed to fit many different single board computers. It uses thermal conductive adhesive which many “cheap” heat sink kits for SBCs don’t have. Eliminates hot spots and reduces throttling. Can be further enhanced by powered cooling over the heat sinks.

Links: Amazon.com*, Amazon.ca*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*

StarTech 2.5" SATA Adapter
StarTech 2.5″ SATA Adapter

The StarTech USB 3.1 to 2.5″ SATA adapter is one I have recommended for many years for use with all kinds of devices including the Raspberry Pi, Orange Pi, ODROID, Libre “Renegade” and Tinker Board. It’s widely compatible and works with gaming consoles as well.

Links: Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*, Amazon.sg*

Orange Pi Wireless Mouse
Orange Pi Wireless Mouse

The Orange Pi official mouse uses 2.4GHz wireless to give you a wireless mouse experience with the Orange Pi

Links: Amazon.com*, AliExpress*

Orange Pi Portable Monitor
Orange Pi Portable Monitor

The Orange Pi monitor is meant to be a portable monitor you can take anywhere. It has a resolution of 1080P and features a hinge in the back that folds out to support the monitor.

Links: Amazon.com*, AliExpress*

Note for USB Booting

Important: Only the top blue port of the Orange Pi 5 is fast for using USB storage. You can use a USB-connected SSD.

The bottom port, despite being blue, is USB 2.1.

Keep in mind that if you are using a USB SSD then in the instructions anywhere it says /dev/nvme0n1 you will need to use /dev/sda or whatever drive was assigned when you plug in your drive via USB.

Note for Official Debian / Ubuntu Images (Updated 1/10/2023)

Orange Pi has updated their official images to support directly booting from NVMe. This means that if you are using the official Ubuntu or Debian from orangepi.org then you can actually write the image directly to the SSD. This is the easiest way to get it going.

You first need to write the image to a SD card and then run:

sudo orangepi-config

Then choose System->Install->Boot from SPI and install the new updated boot loader to the SPI flash.

This did not work at launch but is working now. It is now possible to simply write the official images directly to NVMe and boot with it after updating the boot loader! The following instructions will still be useful for other operating systems or operating systems that do not support booting directly from NVMe.

Note for Armbian (Added 1/20/2023)

Armbian has a similar install utility as orangepi-config. For Armbian you will use:

sudo armbian-config

Then choose System->Install->Boot from eMMC and install the new updated boot loader to the SPI flash.

You should also install the system to Armbian using this method. The instructions in the rest of the article are meant for operating systems that will not boot natively from NVMe. It uses a SD card as the boot loader to essentially let you boot anything (even ones not designed to boot directly from NVMe).

Supported SSD Sizes (Updated 1/26/2023)

Important: There is also a type of M.2 drive called a M.2 SATA drive. This is an older type of drive that most of you won’t have but some of you will. This type of drive is supported by the Orange Pi 5 but you have to add a special overlay (overlays=ssd-sata). If your NVMe drive shows up as /dev/sda instead of /dev/nvme0n1 then you have a M.2 SATA SSD. If you have a M.2 SATA drive follow this excellent guide by u/jng98908 on reddit.

You can use either a 2230 or a 2242 size NVMe drive.

There are actually holes for mounting hardware at both places.

Using a 2230 size NVMe drive looks like this:

Orange Pi 5 with 2230 NVMe drive mounted
Orange Pi 5 with 2230 NVMe drive mounted

It’s totally fine to use a larger one but they will be hanging off the edge of the board. As you can see I do not have the mounts installed on my board. I just leave the 2230 drive in the port like this but it is on my to-do list to find some mounts for the M.2 drive for this board.

SD card boot loader – Preparing SD Card

First you should have a completely working installation on a SD card of the OS that you would like to use. I used the official Debian desktop image for this guide (recommended) so if your partitions are different it may be your flavor of Linux and need slightly altered instructions.

If you have an already working installation you want to move to your SSD you can use this as well most likely.

Note that some operating systems like Armbian will require you to manually go in and modify files on the “boot” partition. If you stick with the official images you should be able to follow the guide as-is but note that some operating systems may have text files (or even files that need to be recompiled with mkimage like for Armbian) for this method to work.

You should completely update first with:

sudo apt update && sudo apt full-upgrade

Preparing SSD

First we are going to completely remove all partitions from the drive so it’s completely blank. Your drive should typically be /dev/nvme0n1:

sudo gdisk /dev/nvme0n1

Now remove all partitions from the device. If you press “p” it will print out the partitions. You can then use “d” to delete them.

Here’s an example on mine:

root@orangepi5:~# sudo gdisk
GPT fdisk (gdisk) version 1.0.6

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/nvme0n1: 250069680 sectors, 119.2 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): E3017ECA-4571-4F62-A39F-4BA2A4323BD8
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 250069646
Partitions will be aligned on 64-sector boundaries
Total free space is 8350 sectors (4.1 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1              64            8063   3.9 MiB     0700  loader1
   2           16384           24575   4.0 MiB     0700  loader2
   3           24576           32767   4.0 MiB     0700  trust
   4           32768         1081343   512.0 MiB   EF00  boot
   5         1081344       250069646   118.7 GiB   8300  rootfs

Command (? for help): d

Keep pressing d until all the partitions are deleted. Once they are gone use the ‘w’ command to write your changes.

Cloning Installation to SSD

We’re now ready to clone your installation to the SSD. We can now copy your drive to the SSD with the following command:

cat /dev/mmcblk1 > /dev/nvme0n1

Wait for the operation to complete (there won’t be any output but you will have a cursor again and be able to type new commands). Remember that you are copying an entire drive from one to another basically with that one command.

Mine took about 30-45 minutes (although I was using a 64GB SD card and the larger SD card you use the longer it will take to copy the whole drive).

If you are having any trouble with permissions try becoming “root” first with:

sudo su

Now try running the command again and as the superuser you should not encounter any permission errors.

Change SD card’s rootfs UUID

We need to change our SD card’s UUID so that it doesn’t try to boot from that partition. We can set it to a random one with the following command:

sudo tune2fs -U random /dev/mmcblk1p2

If you get an error with the previous command regarding csums try the following command instead:

sudo tune2fs -O metadata_csum_seed -U random /dev/mmcblk1p2

We can verify that it has changed with blkid like this:

root@orangepi5:~# sudo blkid
/dev/nvme0n1p1: SEC_TYPE="msdos" LABEL_FATBOOT="opi_boot" LABEL="opi_boot" UUID="0257-2A31" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="bootfs" PARTUUID="0a65713b-d4b4-0642-a3a4-ebc357e507a1"
/dev/nvme0n1p2: LABEL="opi_root" UUID="ae948e48-3646-4f5c-be01-73168e079bc8" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="7490e84a-f585-944e-9ce6-f275f067a023"
/dev/mmcblk1p1: SEC_TYPE="msdos" LABEL_FATBOOT="opi_boot" LABEL="opi_boot" UUID="0257-2A31" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="bootfs" PARTUUID="0a65713b-d4b4-0642-a3a4-ebc357e507a1"
/dev/mmcblk1p2: LABEL="opi_root" UUID="37a6ee0a-e61d-470a-9e53-eaf51726942c" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="4f32d51c-0523-1248-9bc3-092d1f11c594"

Notice that /dev/nvme0n1p2 and /dev/mmcblk1p2 no longer have matching UUIDs. This is exactly what we want.

Change SSD’s boot UUID

Next we are going to change the boot partition’s UUID on the SSD. This will make it so that the mounted /boot folder inside your operating system actually mounts the SD card (which is your actual boot loader in this configuration).

First make sure you have mtools with:

sudo apt install mtools -y

Now we can change the UUID with:

sudo mlabel -N aaaa1111 -i /dev/nvme0n1p1 ::

You can verify these are different using the same sudo blkid command as the previous section.

Run fsck

Before we reboot run fsck on the drive like this:

sudo fsck -yf /dev/nvme0n1p2

This will prevent you from having to run fsck on the CLI the first time you try to boot.

Reboot and Verify

Now reboot the Orange Pi 5 with:

sudo reboot

With any luck you should be booted using your SSD! We can verify this with the mount command like this:

root@orangepi5:~# mount
/dev/nvme0n1p2 on / type ext4 (rw,noatime,errors=remount-ro,commit=600)
/dev/mmcblk1p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=936,iocharset=utf8,shortname=mixed,errors=remount-ro)
/dev/nvme0n1p2 on /var/log.hdd type ext4 (rw,noatime,errors=remount-ro,commit=600)

Here we can see that our root partition (/) is indeed on /dev/nvme0n1p2 and not /dev/mmcblk0p2. We can also see that my /boot folder is properly mounted is /dev/mmcblk0p1 (the SD card which is serving as our boot loader). Success!

Resize NVMe Partition (Added 1/24/2023)

You can use Orange Pi’s built in resize application if you are using one of the official operating systems:

sudo /usr/lib/orangepi/orangepi-resize-filesystem start

Testing Performance

For the guide I used a SSSTC 128GB 2230 M.2 NVMe drive. These are available on Amazon for around $10-12 (also see Kioxia 128GB M.2 2230 module*).

You can verify the performance of your drive on Pi Benchmarks using the following command:

sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash

Here are the results:

     Category                  Test                      Result     
HDParm                    Disk Read                 375.32 MB/s              
HDParm                    Cached Disk Read          381.15 MB/s              
DD                        Disk Write                234 MB/s                 
FIO                       4k random read            47080 IOPS (188321 KB/s) 
FIO                       4k random write           35128 IOPS (140514 KB/s) 
IOZone                    4k read                   75628 KB/s               
IOZone                    4k write                  67285 KB/s               
IOZone                    4k random read            35874 KB/s               
IOZone                    4k random write           70620 KB/s               

                          Score: 17,718

The full Orange Pi 5 benchmark can be viewed here on Pi Benchmarks.

That is an outstanding score. We are getting NVMe performance. This score actually even beats my ODROID M1 benchmark.

The Orange Pi 5 is without a doubt a very powerful board and is performing exactly where it should be.

Other Resources

I’ve also covered how to install Steam on the Orange Pi 5 here

I’ve also reviewed the Orange Pi portable monitor here (with the Orange Pi 5 connected)

If you are looking for alternative WiFi adapters for the Orange Pi 5 see my using E-keyed WiFi adapters with the Orange Pi 5 guide here!

I’ve written a review for the Orange Pi 5 available here

All of my single board computer reviews are available here

Subscribe
Notify of
guest

155 Comments
Inline Feedbacks
View all comments
Patryk
Patryk
1 year ago

I know it’s a lot to ask, but would you be interested in doing a small update about running Arch-based distro on NVMe drive?
Would it follow the same procedure of installing the RebornOS on SD card, then cloning it to the NVMe with remaining steps? (How would the resize work in this case?)
Thanks!

Patryk
Patryk
1 year ago

Actually I followed your normal tutorial step for step and it worked perfectly!
– first I installed the RebornOS from the GitHub project for opi5 board on the SD card
– I cloned the system to SSD with cat
– followed all the standard instructions you described in the guide, one exception was changing UUID with random method which would not cooperate in my case, I had to manually specify random UUID.
– I have fully functional system with boot on SD card and system on the SSD, no major issues so far, everything works very responsively

Do you have any ideas how to attempt changing the contents of SPI to point to boot partition on the SSD to free the SD card slot, or maybe where to start the research? I’m planning to do some poking with spidev python library, not sure if it’s the right tool but I’ll post update in case I find a method that works.

Anyway, thanks for great tutorial!
w(ARM) regards ๐Ÿ˜€

Dmitry
Dmitry
1 year ago

Hello. What is aaaa1111 in sudo mlabel -N aaaa1111 -i /dev/nvme0n1p1 :: ?

cld
cld
1 year ago

How to extend the nvme0n1p2 to the max size after reboot?

cono
cono
1 year ago

Would be great to see how ssd fit board. As official documentation suggest 2242 and you are using 2230

cono
cono
1 year ago

Thanks. Appreciate your quick reaction ๐Ÿ˜€

Javier Mitchell
Javier Mitchell
1 year ago

ARBIAM NVME boot

I still cannot boot raspbian from NVME, I don’t think the section for Armbian NVME is correct
In any case I did follow those instructions, and also tried using the standard ( nand-sata-install, then option 7 ( Install/Update the bootloader on SPI flash) and was NOT able to boot from NVME
I even tried booting from one of the other Linuxes ( Ubuntu/Debian) and tried “nand-sata-install option 7”, and again it did NOT work
I will be very happy if somebody will confirm the EXACT steps to install RASMIAN into NVME

Thanks

Javier Mitchell
Javier Mitchell
1 year ago

Thanks, I will give it a try and let you know

javier mitchell
javier mitchell
1 year ago

James
I did try one of the newer releases and it works flawlessly
Thanks , I was starting to think I was useless!

Mahdi
Mahdi
1 year ago

Hi,

Thnaks, I finally booted from NVME. Could we remove the sd card and just boot from nvme? I could not do that and the SD card should be pluged.

jb1
jb1
1 year ago

excellent write up, you and armbian folks have saved the day for the orange pi 5 community for those without the skills… shame on orange pi for their poor support, they could have worked with the community a little better. i even had to make my own case because there was nothing out, fortunately more free designs are showing up . regardless, nvme score is impressive for a sbc, its going to hard for next PI5 To catch up… at this price point.

Description: orange pi 5-armbian- 4 gb- 256 gb nvme active cooling
(Optional) Enter alias to use on benchmark results. Leave blank for completely anonymous.
Alias (leave blank for Anonymous): jb
Result submitted successfully and will appear live on https://pibenchmarks.com within a couple of minutes.

Category Test Result
HDParm Disk Read 371.92 MB/s
HDParm Cached Disk Read 375.63 MB/s
DD Disk Write 289 MB/s
FIO 4k random read 49829 IOPS (199318 KB/s)
FIO 4k random write 43115 IOPS (172463 KB/s)
IOZone 4k read 79670 KB/s
IOZone 4k write 98346 KB/s
IOZone 4k random read 49865 KB/s
IOZone 4k random write 94361 KB/s

Score: 22474

Compare with previous benchmark results at:
https://pibenchmarks.com/

on a different point, anyone have issues with vertical usb port, wireless usb doesn’t work on it. thanks again

jb1
jb1
1 year ago

still no vertical usb, usb c output, and video drivers didnt work. wondering if others have issue…. running a 1/10 nightly build jammy armbian with cinnamon. i ran armbians recommended video card repository, installed but still didnt work. no luck with dual monitor. thanks

ะะปะตะบัะตะน
ะะปะตะบัะตะน
1 year ago
Reply to  jb1

Description: SSD SAMSUNG NVMe 2242
(Optional) Enter alias to use on benchmark results. Leave blank for completely anonymous.
Alias (leave blank for Anonymous): Prokopa
Result submitted successfully and will appear live on https://pibenchmarks.com within a couple of minutes.

Category Test Result
HDParm Disk Read 372.79 MB/s
HDParm Cached Disk Read 368.23 MB/s
DD Disk Write 255 MB/s
FIO 4k random read 87896 IOPS (351587 KB/s)
FIO 4k random write 44618 IOPS (178474 KB/s)
IOZone 4k read 75550 KB/s
IOZone 4k write 108089 KB/s
IOZone 4k random read 39710 KB/s
IOZone 4k random write 71739 KB/s

Score: 21187

Compare with previous benchmark results at:
ะงัƒั‚ะพะบ ะฝะต ะดะพั‚ัะฝัƒะป)