Orange Pi 5 - Boot from NVME

Hi There,

I have been using Diet pi on a RPI 4 for nearly 2 years now.

I have recently received my Orange Pi 5 (16gb). Diet pi is currenrtly booting from the SD card correctly.

I have an NMVE drive in the Pi and can see it in Diet Pi Drive Config.

How do I transfer the OS to the NVME to allow booting from the NVME?

I do not have a NMVE drive for my PC (without taking my PC apart!) so idealy would need to be flashing the NVME on the SBC itself.

Anyone able to point me in the right direction? I belive I need to use a “dd” command to copy the image to the NVMe but am a bit lost!

Kind Regards!

Have a look to follow blog post Moving a running DietPi system to a USB stick/disk or an onboard eMMC – DietPi Blog

Thanks for this,

I have just tried this and after removing the SD card it fails to boot.

Wonder if there is any specific setup for this SBC?

At least for my OPi5 it was needed to flash SPI to allow USB/NVMe boot. I need to say, I was using Orange Pi Debian for this, as they have a menu option for this :sweat_smile:

Not so hard to do from DietPi or Armbian: DietPi-Config | Implement Armbian U-Boot update script · Issue #6280 · MichaIng/DietPi · GitHub

. /usr/lib/u-boot/
write_uboot_platform_mtd "$DIR" /dev/mtdblock0

Sorry for confusion!

I have booted Orange Pi Debian image, Ran the tool to set SPI to boot from NVME.

Now i used DD command to write Diet pi image to NVME but it doesnt boot ?

You need to update the bootloader and not just set the option to boot from NVMe

Thanks all!

Managed to wipe all partions from the SPI and reinstall bootloader.

Booting from NVME alone into dietpi now

1 Like

Awesome…will this auto update the uboot if/when kernel is upgraded?

Very very awesome…I hope to be able to get my Orange Pi PC done this way…I know it only runs under USB 2.0…but has to be SO much faster than a stupid SD card…even a class 10 one.

Better to use a NVMe instaed of USB connected device :wink:

1 Like

And care for the right M.2 card (nVME card).

1 Like

I think for now we’ll just add the option to dietpi-config to manually update/flash U-Boot to the root device and/or SPI. As long as the board boots, there is usually no reason to update the bootloader, as this is its only task. Flashing U-Boot without specific reason (like enabling booting from other devices) on a perfectly functioning device is also a risk, especially with the Armbian U-Boot packages. It happened quite a few times that a new U-Boot build suddenly broke boot. Also Armbian does not automatically flash U-Boot when the package is updated, for the same reason I suppose.

Is there any way to create a script that will put the uboot and image stuff on the SD and have it point to the root partition on the NVME/USB device…this way allowing the SBC’s that don’t have flashable EEPROMS to allow for booting to USB/NVME to be able to have the SD card be the boot device, but have the external faster device be the root device?

The Orange Pi 5 can boot from NVMe fully. There is no need for a SD card at all. It’s already quite fast booting in 5 seconds.

Startup finished in 3.292s (kernel) + 2.211s (userspace) = 5.503s.

I understand this…I am referring to other devices that may not have that ability

I had this “feature” before I updated my Opi5’s bootloader:

  1. Installed my system on a SD card
  2. Copied my whole SD card via dd to the NVMe card (e.g. dd if=/dev/mmcblk0 of=/dev/nvme0n1 bs=1M status=progress)
  3. Rebooted

That led to a state, where the UUIDs, PTUUID, etc. of the SD card and the NVMe were identical.
The system booted from the SD card and mounted the root filesystem from the NVMe. :slight_smile:

But I am not sure whether this is a recommendable solution.

Ultimate solution is this: USB boot | Provide tiny SD card image as USB boot relay · Issue #6186 · MichaIng/DietPi · GitHub
I’ll most likely not have time for this until v8.16, but it has higher priority to me and is generally independent of DietPi releases (no change required to DietPi, just an additional set of bootloader-only images).

I just tried the new option in 8.16 -> dietpi-config -> Advanced Options menu to update the SPI flash bootloader.

It did not work. It was previously booting from NVMe with the solution below:

. /usr/lib/u-boot/
write_uboot_platform_mtd "$DIR" /dev/mtdblock0

When I used the new option in dietpi-config menu to update the SPI flash bootloader, NVMe stopped booting. I had to flash and boot from an SD to run the and write_uboot_platform_mtd to make NVMe to boot again.

Am I doing something wrong? Or is the new option in dietpi-config not working as expected?

ping @MichaIng can you have a look pls

1 Like

Can you test again whether the system comes up after a reboot? We just tested it and it seems that this bootloader has issues with reboot but requires a power cycle to come up again. The dietpi-config update and write_uboot_platform_mtd however (should) do exactly the same: The only difference is that we make the dd output visible.

Probably we should find a source for and download the one from Orange Pi themselves instead of flashing the one from Armbian :thinking:.

1 Like