Orange Pi Zero 2 USB SSD Boot Guide

Orange Pi Zero 2 SSD Boot Guide
Orange Pi Zero 2 SSD Boot Guide

During my recent coverage of SBCs I’ve been benchmarking them using SSDs. The process for booting from a SSD varies across different boards. I’ve found the documentation for some of these to be lacking / nonexistent and the Orange Pi Zero 2 is one of these.

Today I wanted to benchmark the Orange Pi Zero 2 with the SSD and given the lack of documentation I’m going to document my process for setting it up. The Orange Pi Zero 2 will require a sacrificial SD card to bootstrap the process and has USB 2.0 ports. With those limitations in mind let’s set it up and see how it performs!

Hardware Used

Orange Pi Zero 2
Orange Pi Zero 2

The Orange Pi Zero 2 is a low-cost board from the Orange Pi line of SBCs. It has both a 512 MB or 1 GB RAM option available. Built-in WiFi with included external antenna. Also includes case and a short USB-c power cable. Seems to be pretty widely available in most countries.

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

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 and Orange Pi. 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*

Sabrent Powered USB Hub
Sabrent Powered USB Hub

The Sabrent powered USB hub delivers a whopping 2.5A of dedicated power for your USB attached devices. It will easily power the most thirsty of setups such as NVMe enclosures.

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

Note: Make sure Amazon doesn’t try to take you to the non-powered version and that it’s the one with the AC adapter that plugs in to provide extra power

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*

Choosing a Drive

Some possible drive types include 2.5″ SATA, M.2 SATA, mSATA and M.2 NVMe.

I do not recommend using a NVMe drive with the Orange Pi Zero 2 because it has USB 2.0 ports. That is a total and complete waste as we are definitely going to max out the USB 2.0 bus with even a garbage-tier unbranded 2.5″ SSD.

I typically do not recommend USB flash drives either. No matter how fast you think it is unless it is a REAL solid state drive (SSD) it’s slower than your SD card.

The best choices are definitely something like an older cheap 2.5″ SATA or M.2 SATA SSD. I will be using a 2.5″ SATA drive (Crucial MX200 250GB*) to write this guide.

First Step – Have Working Installation

The first step in this method is to already have a working installation of the OS you want to use for SSD booting installed on your SD card.

Many of you will have this already unless you’re installing something totally new. The next thing you should do is make sure it is fully updated with:

sudo apt update && sudo apt full-upgrade -y

Having a fully updated installation will make everything much simpler as we are going to clone a fully working and up to date installation to our SSD instead of try to do a fresh image on a board that isn’t really intended for SSD booting.

Clone Installation

With the Orange Pi Zero 2 booted up using your working installation it’s time to plug your SSD into the Orange Pi Zero 2 using your USB to X adapter.

You should see devices pop up for /dev/sda in lsblk:

orangepi@orangepizero2:~$ sudo lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 232.9G  0 disk 
├─sda1        8:1    0     1M  0 part 
├─sda2        8:2    0    15M  0 part 
└─sda3        8:3    0 232.9G  0 part 
mmcblk1     179:0    0  59.5G  0 disk 
└─mmcblk1p1 179:1    0  58.9G  0 part /
zram0       252:0    0 492.1M  0 disk [SWAP]
zram1       252:1    0    50M  0 disk /var/log
zram2       252:2    0 492.1M  0 disk /tmp

First clean off the SSD by running:

sudo fdisk /dev/sda

Delete all partitions until it is completely blank.

Now we can copy the entire SD card to our SSD with the following command:

sudo cat /dev/mmcblk1 > /dev/sda

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).

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 UUID

Now unplug the SSD and plug it back in. 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/mmcblk1p1

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

orangepi@orangepizero2:~$ sudo blkid
/dev/mmcblk1p1: UUID="9c0a441b-5aaf-4cf1-bec7-b457d3966cb6" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="e8ce0794-01"
/dev/zram0: UUID="66b180ff-2899-431b-b8b7-8347d9af85eb" TYPE="swap"
/dev/zram1: LABEL="log2ram" UUID="d87403e0-1d2f-4356-905d-9dfaba14b6ee" BLOCK_SIZE="4096" TYPE="ext4"
/dev/zram2: LABEL="tmp" UUID="9abe5f8e-49b7-41d6-839b-3d2e0aa3b9cd" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda1: UUID="5dd5b836-fb32-4678-908e-d23f7a028780" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="e8ce0794-01"

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

Run fsck

Before we reboot run e2fsck on the drive like this:

sudo e2fsck -yf /dev/sda1

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 with:

sudo reboot

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

orangepi@orangepizero2:~$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=431840k,nr_inodes=107960,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=100776k,mode=755)
/dev/sda1 on / type ext4 (ro,noatime,errors=remount-ro,commit=600)
/dev/sda1 on /var/log.hdd type ext4 (ro,noatime,errors=remount-ro,commit=600)
/dev/zram1 on /var/log type ext4 (rw,relatime,discard)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=100772k,nr_inodes=25193,mode=700,uid=1000,gid=1000)

Here we can see that our root partition (/) is indeed on /dev/sda and not /dev/mmcblk1. Success!

Resize SSD Partition

Once you’ve rebooted and verified you are booted from the SSD we can resize the SSD’s partition to be the same size.

We can use a built in service on the Orange Pi to do this. Use the following command:

sudo systemctl start orangepi-resize-filesystem.service

This will take a few minutes depending on how large your SSD is. Once it is finished verify you are using the full space on your SSD with:

orangepi@orangepizero2:~$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 232.9G  0 disk 
└─sda1        8:1    0 230.5G  0 part /
mmcblk1     179:0    0  59.5G  0 disk 
└─mmcblk1p1 179:1    0  58.9G  0 part 
zram0       252:0    0 492.1M  0 disk [SWAP]
zram1       252:1    0    50M  0 disk /var/log

Here we can see that my SSD’s partition is now the correct size for a 250GB SSD and is no longer only 58.9G like our original partition from the SD card.

Troubleshooting Note

The first time you try rebooting you may get an initramfs screen that says you need to do a manual fsck. This usually means you didn’t completely clean the partitions off the SSD (don’t be ashamed, I didn’t the first time either which is why I know it can be fixed). That can be fixed by using:

e2fsck /dev/sda1 -y 

or:

fsck.ext4 /dev/sda1

It should say the filesystem is clean after this and let you boot normally. Once it boots up it wouldn’t hurt to give it a:

sudo e2fsck /dev/sda1 -y

Fixing these may take a while. I had to do this second fsck because even though my system booted after the first fsck the disk was mounted as read-only due to additional errors (which is why it will let you fsck the root partition while actively booted which is normally a no-go, it’s in a protected read-only mode due to errors).

After this comes out clean reboot one more time and you should be all set with a read-write root partition on your SSD!

Testing Performance

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

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

I ran the benchmark with full knowledge that we were using USB 2.0 and were going to be limited in our score. Nevertheless I wanted to see what the improvement over using the SD card was.

Here are the results:

     Category                  Test                      Result     
HDParm                    Disk Read                 37.08 MB/s               
HDParm                    Cached Disk Read          36.94 MB/s               
DD                        Disk Write                37.8 MB/s                
FIO                       4k random read            4745 IOPS (18980 KB/s)   
FIO                       4k random write           4426 IOPS (17704 KB/s)   
IOZone                    4k read                   8094 KB/s                
IOZone                    4k write                  10667 KB/s               
IOZone                    4k random read            8020 KB/s                
IOZone                    4k random write           10652 KB/s               

                          Score: 2,593                                        

You may view the full benchmark on Pi Benchmarks for the Orange Pi Zero 2 here.

Wow, that is a score of 2,593! That absolutely smashes any other tests for the Orange Pi Zero 2 on the site and is the new world record.

To give some context here the maximum score you can achieve over USB 2.0 is something around 2500-2600 points. This is true on Raspberry Pi Model 3s and older which only have USB 2.0 ports. They also max out around the same score.

This is more than double the fastest SD card score anyone has ever achieved on the board. That means it is absolutely worth it to use a SSD with the Orange Pi Zero 2!

Conclusion

It’s working 100%! We are getting full USB 2.0 speeds and maxing out the bus and substantially outperforming any micro SD card. It’s not too difficult to achieve this setup using this method.

It’s also very cheap. You can find 2.5″ SATA drives for less than $20 as well as M.2 SATA drives and those will more than max out the bus.

I highly recommend trying this for all Orange Pi Zero 2 owners! It was worth it on the Raspberry Pi 3 even over USB 2.0 (and I was doing it back then like in this benchmark with an almost identical score on the Pi 3 due to the USB 2.0 bus just like with this one). It’s worth it on the Orange Pi Zero 2 over USB 2.0 as well. A 2x-2.5x increase in speed is worth it for a relatively easy setup process.

Just make sure to use a cheap drive as anything more is massive overkill / a waste due to USB 2.0 limitations!

Other Resources

I’ve also reviewed the Orange Pi portable monitor here

Make sure you check out my Orange Pi Zero 2 review and tips/tricks guide

If you have the Orange Pi i96 check out my updated image available for it here

Another amazing cheap use of 2.5″ SATA adapters is using them for upgrading your last-gen PS4 or Xbox One gaming consoles!

Want to see an even insanely cheaper board than the Orange Pi Zero 2? Check out my guide on the Orange Pi i96 headless board which is available for something like $7.

If you like retro gaming you may be interested in my ODROID Go Super Guide!

35 thoughts on “Orange Pi Zero 2 USB SSD Boot Guide”

  1. Avatar for Rafael R.

    Hello James,
    Thank you so much for the tutorial. I’m an extremely beginner linux user and yet I was able to accomplish almost the entire tutorial.

    1)With my Orange Pi 3 LTS I managed to achieve 2771(actually expecting more with SSD + USB3 port), but maybe my adapter is not so good.

    2) When i tried to resize “Failed to start orangepi-resize-filesystem.service: Unit orangepi-resize-filesystem.service not found.”
    Tried both “sudo systemctl start orangepi-resize-filesystem.service” and “sudo systemctl enable orangepi-resize-filesystem.service”

    OS: Armbian bullseye

    Any idea what might be going on?

    Thanks again

  2. Avatar for Guima

    How can I reinstall a fresh image of DietPi in my SSD card after that ? I mean, I’m trying to do it right now but it’s starting just through USB->SSD, How can I go back and start through SD card again?

    1. Avatar for James A. Chambers

      Hello Gulma,

      If you remove or reformat the SD card it won’t boot anymore. It’s using that as your boot partition. The Orange Pi Zero 2 doesn’t support booting from SSD.

      If you want a fresh install just reformat your SD card. It won’t boot from the SSD anymore but that’s because you need both pieces for this to work. Hopefully that helps!

  3. Avatar for Kristof.b.Dragon
    Kristof.b.Dragon

    Hi James,

    Thank you for this tutorial, following it I managed to achieve ssd boot on the newer orangepi zero 3.
    Benchmark Score: 2177

    Greetings

  4. Avatar for Nico

    Hi James
    nice manuel *thumbs up* I verify this on a ORANGE PI ZERO PLUS. Armbian 23.8.1 Bullseye with Linux 6.1.63-current-sunxi64
    Greatings Nico

  5. Avatar for Mic D

    For anyone using this boot method and struggling with kernel updates – it might be non-obvious that to properly upgrade and switch your kernel, you have to perform the upgrade on the system installed on the SD card (the “boot drive”) as well. In my case (using Armbian), I did it like this:
    – upgrade your OS on SSD
    – recover SD card’s previous UUID (copy-paste the UUID from your SSD and use it as parameter of “tune2fs” step)
    – shutdown, unplug the SSD, power up
    – upgrade your OS on SD card
    – perform the “tune2fs” step again, to randomize card’s UUID
    – shutdown, plug back in the SSD, power up

    I’m pretty sure the entire OS on SD card upgrade is not necessary, it’s probably just the kernel image and bootloader that needs to be upgraded, but for the lack of a better method, this might come in handy for other people.

    1. Avatar for James A. Chambers

      Hey Mic D,

      Yes, this is exactly right. You don’t need the entire OS on the card. You can even delete the root partition off the SD card and use the space for other things afterward (as long as you leave the boot partition alone).

      Thanks for the steps as well!

  6. Avatar for George Varghese

    Thanks for the clear instructions that is true for OrangePiZero3 too. Myine is ” Score: 9357 ” .
    ‘ /mtdblock0 31:0 0 16M 0 disk ‘ – Can this be used to boot directly from the SSD ( without keeping the uSD in its place )?

    1. Avatar for James A. Chambers

      Hey George,

      Great score, thanks for sharing and trying out the benchmark!

      So unfortunately this board needs the uSD in place to continue booting from SSD. It is hard-coded essentially to boot from SD card initially. Hopefully that helps!

  7. Avatar for Jan-Erik

    Why does this fail if I empty the SDcard after this operation? Nothing should be running from there as I understand it. I did “mkfs -t ext4 /dev/mmcblk1p1” and it never boots again after that.

    1. Avatar for James A. Chambers

      Hey Jan,

      Great question. The SD card is actually serving as your boot loader. It can’t be wiped and can’t be reused unfortunately for this method. The Orange Pi Zero 2 does not support natively booting from SSD. It needs to be bootstrapped using the SD card.

      Hopefully that helps!

Leave a Comment

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

Type here..

Exit mobile version