ODROID N2+ Petitboot SSD Boot Guide

ODROID N2+ SSD Boot Guide
ODROID N2+ SSD Boot Guide

Configuring the ODROID N2+ for USB booting can be a little bit tricky. There are guides out there that will both use a SD card to bootstrap the SSD booting and other guides that use Petitboot but have complex setup instructions.

Today I want to show you a simple method that I used to get SSD booting set up on the ODROID N2+ so I could perform my storage benchmarking on the device for my review. I will be using a NVMe SSD but you may use other types of SSDs as well. Let’s get started!

Hardware Used

ODROID N2+
ODROID N2+

The ODROID N2+ is a great board with a built-in Petitboot bootloader capable of booting from SSDs and other types of devices. The N2+ is an overclockable board which is one of the advantages it has over the M1. Available in 2GB and 4GB variants.

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*

ASUS ROG Strix NVMe Enclosure
ASUS ROG Strix M.2 NVMe Enclosure

If you really want to take things over the top the ASUS Rog Strix M.2 NVMe enclosure uses the latest USB 3.2 Gen2 specification, is RGB capable and works with the Pi! Unsurprisingly, adding the extra lighting does take extra power! A powered USB hub is also required for this enclosure. More widely available than the ICY BOX but tends to be on the expensive side.

Links: Amazon.com*, AliExpress*, 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*

First Step: Install OS to SD Card/eMMC

For this method the first thing you will need is an already working copy of the OS you would like to install to the SSD installed on either a eMMC or SD card.

If you want to install your existing N2+ installation onto a SSD you can skip to the next step.

You should fully update the image before proceeding to the next step with:

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

Once you’re fully upgraded you’re ready for the next step.

Copy eMMC / SD card to SSD

Now it’s time for the magic of this method. We are going to completely clone your working installation to your SSD.

Connect your SSD to the running ODROID. You should see devices pop up for /dev/sda in lsblk:

odroid@odroid:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    0 931.5G  0 disk 
├─sda1   8:1    0   128M  0 part /media/usb0
│                                /media/boot
└─sda2   8:2    0  14.4G  0 part /media/usb1

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 memory card to our SSD with the following command:

sudo cat /dev/mmcblk0 > /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.

Run fsck

Now unplug the SSD and plug it back in so it reads our new partition table from the device.

Before we reboot run e2fsck on the drive like this:

sudo e2fsck -yf /dev/sda2

NOTE: Some images for the N2+ only have a single root partition. This is fine since the “boot” partition is unnecessary with Petitboot but many images still have it. If yours doesn’t then you will use /dev/sda1 instead here and for the rest of the guide.

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

Configuring Petitboot

Now change the switch on the side of the N2+ from eMMC to SPI flash (if you were using a eMMC for the first steps). This will tell the N2+ to boot the Petitboot bootloader.

You should remove your SD card / eMMC at this point as they will have the same partition IDs as your SSD installation (these can be changed and /etc/fstab and boot.ini can be updated accordingly but I recommend getting it working first by taking out the SD/eMMC).

When the ODROID boots it should look like this:

Petitboot Main Menu
Petitboot Main Menu

Notice at the top we have our SSD drive as the only boot option showing. We aren’t ready to boot it just yet though. First we need to make a change.

Scroll up to the entry below “USB: SDA1 / F702-E9CB” (but don’t press enter). On my setup it says “NO LABEL” but if your drive has a label (or you applied one) it may show that instead. Now press the letter “e” to edit the boot line.

This part is a little annoying but you only need to do it once the first time you set up your SSD. We need to edit the boot parameters which are currently pointing to /dev/mmcblk0p2. We are going to change this to /dev/sda2.

It’s really tricky to edit the line we need to edit. Let me show where/what we need to edit first:

Petitboot - Edit Boot Entry
Petitboot – Edit Boot Entry

You can see that we need to edit the “Boot arguments” line. This is not as easy as it looks. You need to scroll down to that entry with the arrow keys but because it goes off the screen it won’t be obvious that you have it highlighted.

The way to make sure you are on the right entry is once you have it highlighted (or you think you do) start holding the left arrow key. After a few seconds you should see it start scrolling to the left. The entry we need to edit is literally all the way at the beginning. It’s the very first entry.

On your ODROID before making this change the very beginning of the line should show:

root=/dev/mmcblk0p2

Change this to:

root=/dev/sda2

Once this is done you’re ready to boot. Press enter to accept the changes and then choose the same entry we just edited and press “Enter” to select it. Your OS should fire up completely booted from your SSD!

Conclusion

That is it! Provided you edited the Petitboot entry for the SSD to point to /dev/sda instead of /dev/mmcblk0 you are all done!

I should note that my performance score on Pi Benchmarks running the SSD through USB 3.0 was 7,476. You can view my benchmark for the ODROID N2+ with a SSD here.

As a comparison the M1 got a score of over 16,000 with the exact same drive. What does this mean? It means that the USB 3.0 bus is actually limiting your maximum speeds. Therefore it doesn’t really make sense to use M.2 NVMe with this board. A regular 2.5″ SATA or M.2 SATA drive will be plenty to hit the USB 3.0 bottleneck / cap.

The overclocking capabilities on this board (vs the M1 which does not have any) did not make up for being limited by the USB 3.0 bus. Not even close. The M1 more than doubled it using a real M.2 socket instead of a USB to NVMe adapter. The USB 3.0 speeds are the bottleneck.

It’s still about 40-50% faster than using an eMMC so it’s a fantastic upgrade nonetheless! It’s especially worth it if you already have older 2.5″ SATA or M.2 SATA drives laying around. This will give you a nice 40-50% performance boost as well as typically a lot more storage capacity (considering the largest official eMMC available is 128GB which is among the smallest of available SSD sizes you can buy).

In other words a SSD is worth using on this board but it is not worth buying or even wasting a fancy NVMe SSD in it because the USB 3.0 bus will limit your speeds to ones that are easily achievable with even mid-range 2.5″ SATA and M.2 SATA drives. Use an older / cheaper one with it and it’s a great / economical choice!

Other Resources

I highly recommend the M1 over the N2+ if you are trying to do NVMe. It’s just much faster without having to use the USB bus

If you have the M1 already I highly recommend my Ubuntu 22.04.1 Legendary ODROID M1 image

If you’re looking for eMMC information definitely see my ODROID eMMC Guide here

If you’re a retro gaming fan and an ODROID fan you should see my ODROID Go Super review here!

Subscribe
Notify of
guest

39 Comments
Inline Feedbacks
View all comments
iFap2Surveys
iFap2Surveys
1 year ago
iFap2Surveys
iFap2Surveys
1 year ago

Hello, firstly just wanna thank you for the fast reply and your contribution to the community.

I am currently using sda1 as i dont have an sda2 partition already. ive also tried: /usr/var/petitboot/mnt/dev/sda1/boot/dtb-5.10.123-meson64/amlogic/meson-g12b-odroid-n2-plus.dtb as the device tree (but revised to fit my hardware and version) but minus the “plus” as i have the “original” odroid N2, but i get I guess i wouldnt mind having to input it everytime on boot, as ive been pretty desperate to make it work. I guess i wait for more support to be or workarounds people might have/create. Thank you!

Brad
Brad
1 year ago

Your instructions are great for the ODROID-N2+, but I got a little hung-up on change from “root=/dev/mmcblk0p2” to “root=/dev/sda2” in Petitboot. Every time I changed it the system would revert back on a restart. Hopefully I can make it easier for the next person. For the record, I have an ODROID-N2+. I used these instructions to flash Armbian directly to the emmc module so I skipped the microSD card altogether. Once I was happy with Armbian running on the eMMC, I used your guide to transfer everything over to the USB HDD and followed all instructions to the very end. Once I was in Armbian I switched to the /boot directory and edited boot.cmd with nano editor:

cd /boot
nano boot.cmd

I edited the “setenv rootdev” line to match your instructions so it looks like this (my drive is sda1, not sda2):

setenv rootdev "/dev/sda1"

If you scroll all the way to the bottom of this file before you exit you’ll see the following notes:

# recompile with:
# mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

I copied that line, exited the nano editor with control-X, and saved the file when prompted.

Back at the command line I entered the compile command from above. I rebooted the system and it started right up as expected.

Stefan
Stefan
1 year ago
Reply to  Brad

Brad,
that was a great help for me, trying to achieve the same on armbian.

I wonder, though, did you figure out how to persist the change to boot.cmd? Mine gets overwritten by armbian-config and I’m left with an unbootable system (which is an issues as I’d like to run it headless).

Probably related to the fact, that the file says “do not change this file, use armbianEnv.txt instead” – however, setting bootenv in armbianEnv.txt seems to be ignored when SPI booting.

Would anyone have a some further hints for me?

Stefan
Stefan
1 year ago

Thanks for clarification. Indeed I had figured the mkimage part, but some Armbian script keeps overwriting boot.cmd, and I haven’t figured out yet which one exactly.

I was fine with Armbian up until that point. But I don’t wan’t to mess too much with that, I’d rather go for the alternative image, as per your suggestion further down here – hoping to get the UART issue fixed as well.

And, I caught an eye on the new H3, which sound incredible interesting as well. Saw someone stating an idle power consumption (headless) < 2W!

David Swinnard
David Swinnard
2 years ago

Thanks for this write-up James. You (and your recent discussion with Douwe) clearly pointed out the steps I needed to boot my new Odroid N2+ from a SSD. I hope to use it to replace the RPi 4 that runs my telescope. Your notes got me past the first hurdle – booting reliably from the SSD. This application requires storing hundreds of ~50MB files during an imaging session, just not something an SD card will handle. (Ubuntu 22.04 easy, Arbian (just because), less so. I will likely stick with Ubuntu.

Stefan
Stefan
1 year ago

James,

are you using vanilla Ubuntu or hardkernel images? I’m currently on Armbian, which runs smoothly, generally speaking, but SPI boot is a pain and there seems to be issues with UART on the pin header.

I was considering hardkernel images, but I’m reluctant with that pretty old 4.x kernel (EOL actually end of January 2023)…

Stefan
Stefan
1 year ago

Hey James,

thanks a lot for your quick reply. Maybe it’s just too late over here, but following your link and selecting the 22.04 version, all I find is “Linux Kernel LTS 4.9.312” in the features section. Any advice?

Stefan
Stefan
1 year ago

Now that is what I’m looking for! Thanks!

Need to figure out how much I’m going to trust in an unknown repository, but I like what you’re saying. Definitely will give this a try.

premarsor
premarsor
2 years ago

Hello!

I tried this method to boot from an SSD and I have some questions.

I didn’t understand very well how I make the changes to stick in Petitboot. In my case, Petitboot reverts always to root=/dev/mmcblk1p1. Therefore, I am wondering if the systems reboots it will always revert the changes and will try to boot from SD card and not SSD?

If you don’t mind I have another question. If I see in my Petitboot root=/dev/mmcblk1p1 should I change it to root=/dev/sda1 or root=/dev/sda2 as you described in your case?

premarsor
premarsor
2 years ago

Thank you very much, James! I will try this and I hope it works. Regarding my second question, is it correct that I should go with root=/dev/sda1 instead of root=/dev/sda2? I didn’t understand in your guide why you used sda2 instead of sda1. In my case, the difference is that I cannot see any sda2 listed and for my SD card I have mmcblk1p1 (block 1, partition 1) instead of mmcblk0p2 (block 0, partition 2) in your case. Probably , you had 2 partition and I have only one.

premarsor
premarsor
2 years ago

Brilliant! Thanks again! I will follow again your guide and if I run into problems, hoping you don’t mind, I will ask you some more questions. Cheers!

premarsor
premarsor
2 years ago

James, I’m glad I could help even without intending to and thank you for being so kind and patient!

So, let’s provide some more help.

What exactly autoboot means? It means the OS will be automatically booted? It means that Petitboot will be loaded and than the OS will be started, after the timeout specified? It also means that if in case of power outage my board will automatically boot after the power comes back? I am asking this because I do not want to disable autoboot and be left out of Petitboot and not being able to re-enable it in case my OS is not properly installed and will give me errors at boot, or prevent my board from rebooting after a power outage. Sorry for asking too many questions, but I want to be sure that switching to SSD and changing the Petitboot will not somehow make my board unusable.

premarsor
premarsor
2 years ago

James, thank you for this very clear explanation. It was exactly what I expected!

I do not want to keep the SD card in. It’s just I have a lot of stuff installed on that server (on the SD card) which took me a lot of time and I don’t want to mess things up. After I succeed, with your kind help, to boot my server from the SSD, the SD card is history. Now, I just need to find a way to replicate the SD card on the SSD. I tried couple of methods (including yours using cat command, but doing it on my computer plugging both the SD card and SSD. By the way, the method with cat command was a little bit slow for me while copying a 130 GB SD card on a 500 GB SSD. A fast method I found was using partclone), but it seems that Petitboot (with cat and partclone methods) does not want to dicover the SSD after I replicate the SD card on it. With the clean same OS installed on SSD, Petitboot recognizes the SSD, but with a replica of my SD card not. I think it has something to do with the SDD partition table which in my case should be msdos. With your valuable information about the Petitboot, I think I will be able to finally succeed of booting from the SSD. Thanks again for your help!

premarsor
premarsor
2 years ago

Hello James! Unfortunately, I need again help.

It was impossible for me to boot the SSD with the partition copied in order to keep all my server settings. I can elaborate on that if you want me to.

So, instead I installed a new OS on SSD (Armbian) and I tried again to follow your guide. This time, I can see my sda1, I can select NO LABEL, I insert the root=/dev/sda1 in the Boot arguments line, and than, in order to make the root=/dev/sda1 stick I notice that I have to select OK and press enter, otherwise it doesn’t stick. I exit with escape and I enter again with e (for edit) in NO LABEL in order to check if root=/dev/sda1 is there and it is. Then, I exit the NO LABEL that I edited and I hit enter in order to boot the machine. It starts booting, but after some lines listed on the screen I can see the message ALERT /dev/mmcblk1p1 does not exists! Dropping to a shell! What am I doing wrong?

I can setup a new device for boot in System configuration, my SSD, and this sticks, but it was impossible to make root=/dev/sda1 to stick and not getting the message about /dev/mmcblk1p1 missing. Can you help me? Thanks a lot!

premarsor
premarsor
2 years ago

James, thank you very much for all your effort and I am sorry for dragging you into a mess like this. It seems that I am very unfortunate picking the worst case scenario for my Odroid N2+.

Anyway, I got the idea about Armbian. I will have to decide which other distribution I can use in order to run it from SSD. After I decide and try again your guide, I will let you know about the result. Furthermore, I have to figure out if it is possible to transfer all my files and settings of my server from the SD card to the server on the SSD. If not, I have to reinstall everything I have on the server on SD card (Openmediavault, Docker, Portainer, Wireguard etc.) to the server on the SSD. It will be a lot of work, but fortunately, in the meantime, I can still run the server from the SD card. I am determined not to give up on using my Odroid N2+ with an SSD, so I might need your help in the future. So, I promise I will keep in touch! Again, many thanks for all your effort to help me and for your kindness and solicitude. Cheers!

douwe emantsal
douwe emantsal
2 years ago
Reply to  premarsor

I used minitool on my pc to clone my odroid sd to an ssd (well an usb adapter for a nvme card actually)

douwe emantsal
douwe emantsal
2 years ago

I have tried for an hour various variation of what you suggested but it simply will not stick for me. It always reverts back to /dev/mmcblk1p1. Very frustrating. May I ask are you too on petitboot version 20220317 (hardkernel too often break things during updates).

douwe emantsal
douwe emantsal
2 years ago

Thanks for your lightning fast reply. True, this is armbian. Thanks to your reply I now realize that I did not quite follow that somehow armbian does not allow the changes to be saved. I changed in boot.ini mmcblk0p1 to /dev/sda1, did the mkimage thing which gave me a new boot.scr and now it boots fine from the usb stick. Note that in my case first petitboot shows up, and after 1 second (I changed the timeout from 10 to 1) it executes kexec and then my retriopie image runs!

Btw fw_setenv skip_spiboot true has no effect for me. Petitboot always shows up. All this is on an ODROID N2+, Armbian with retropie.
Thanks so much for all the information. It’s great.

Brad
Brad
2 years ago

Worked great for me. i bought the M1 just for the nvme but this is a nice bonus for the N2 thanks