Unable to clone OS to NVMe

I have searched the existing open and closed issues

Required Information

  • DietPi version | Core:9 Sub:20 RC:1 branch:master owner:MichaIng
  • Distro version | trixie
  • Kernel version | Linux DietPi 6.1.115-vendor-rk35xx #1 SMP Mon Dec 1 08:58:34 UTC 2025 aarch64 GNU/Linux
  • Architecture | arm64
  • SBC model | ROCK 5B (aarch64)
  • Power supply used | 30 W (5V-3A 9V-3A 12V-2.5A 15V-2A 20V-1.5A)
  • SD card used | Toshiba 4GB HC 4
  • NVMe used | Kingston NV2 NVMe PCIe 4.0 1TB M.2 2280 -SNV2S/1000G

Additional Information

  • Software title | rpi-clone
  • freshly installed
  • lsblk command output:
    NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
    mtddblock0 31:0 0 16M 0 disk
    mmcblk1 179:0 0 3.6G 0 disk
    L_mmcblk1p1 191:1 0 3,6G 0 part /
    nvme0n1 259:0 0 931.5G 0 disk
  • Steps to reproduce

sudo rpi-clone nvme0n1

Expected behaviour

The boot drive should be cloned to the NVMe

Actual behaviour

rpi-clone Version:2.0.26
Unable to locate boot device

Extra details

  • Since the read speed of the SD card slot of the ROCK 5B is quite slow, and I only have a 4GB SD card that’s not in operation, I wanted to clone the OS to the NVMe that I installed.
  • I first tried to follow this guide but since this is written for the Radxa OS it doesn’t work
  • So I found this question with my problem as the solution
  • Unfortunately, as seen above, rpi-clone doesn’t clone the OS to the NVMe as it’s unable to locate the boot device despite both the SD card and the NVMe showing up when using the lsblk command
  • If you need more information, just tell me what you need and how I can provide it

rpi-clone is for RPi, not for radxa devices.

On your device the boatloader need to be on the SD card or the SPI flash.
You could clone your root path to the nvme and then flash the SPI (like described in the radxa guide you posted). Or leave the bootloader on NVME

2 Likes

right, initial “boot” stuff needs to reside on a cheap slower SD card (which must remain in the device), which then initiates the boot, loads the initial kernel yadda yadda, then points everything else to the MUCH faster NVME drive, just make sure you follow the directions
[nice thing with this method, you clone the /boot SD card and keep the .img safe, if it ever corrupts or fries, just reimage and it will automatically come up like it never had a problem]

I also found this…but you might have to tweak it a little to ensure it does everything you need (it appears tailor built for “rasbian” but should work with almost all distro’s as long as they use the same type of filesystem and whatnot

At least that is what I have been doing on many of my simple SBC’s…usually in the form of a larger faster Sandisk Ultrafit USB drive (many of my SBC’s don’t have NVME onboard)

Makes sense why it doesn’t work, then.

So how do I clone my root path to the nvme if I can’t use this program for that?

I have tried what WarHawk suggested but for some reason I get the error -bash: git: command not found when trying to install it with the command git clone ``git@github.com``:adafruit/Adafruit-Pi-ExternalRoot-Helper.git and if I instead use sudo apt-get install adafruit-pi-externalroot-helper from the tutorial I get this error E: Unable to locate package adafruit-pi-externalroot-helper. Is git not a standard command on dietpi? If so, how do I add it?

As for flashing the SPI, the tool rsetup is only preinstalled on Raxda OS and I don’t know how to install it on dietpi sudo apt-get install rsetup results in another E: Unable to locate package error. Sorry if it’s a stupid question, but how can I install it on Dietpi? I’m still a beginner when it comes to Linux. If the bootloader has to stay on the SD card that’s not too big of a deal, but how do I check that once it boots it starts reading files from the NVMe not the SD card? Obviously bigger files on the NVMe will be loaded from there, but I would also like the system files to be loaded from the NVMe so the read and write speed isn’t a bottleneck during regular operation-

You would need to install git

apt install git

Thanks, kind of embarrassing that I couldn’t come up with that myself.

I was able to install the program, but when I try to run root@DietPi:~/Adafruit-Pi-ExternalRoot-Helper# -d /dev/nvme0n1

after running cd Adafruit-Pi-ExternalRoot-Helper

I get -bash: -d: command not found

Is there some other program that need to install, or was there an issue while installing the program?

Can you share the exact commands, one by one, you using

This is the example

cd Adafruit-Pi-ExternalRoot-Helper
sudo ./adafruit-pi-externalroot-helper -d /dev/xxx

Sorry, I was under the wrong impression that since cd Adafruit-Pi-ExternalRoot-Helper changes the directory to ./Adafruit-Pi-ExternalRoot-Helper the ./adafruit-pi-externalroot-helper part of ./adafruit-pi-externalroot-helper -d /dev/xxx from the tutorial was unnecessary. After using sudo ./adafruit-pi-externalroot-helper -d /dev/nvme0n1 I got the response

Target drive = /dev/nvme0n1

[start] Will create new ext4 filesystem on /dev/nvme0n1

[start] If there is data on /dev/nvme0n1, it will be lost.

Really proceeed? (y)es / (n)o

After confirming with y it installed gdisk, rsync, & parted, and I then got this response

[fs create] Creating /dev/nvme0n11

[fs create] Creating ext4 filesystem on /dev/nvme0n11

mke2fs 1.47.2 (1-Jan-2025)

The file /dev/nvme0n11 does not exist and no size was specified.

What could be causing this?

The script just appended 1 to the device name, but it should be p1 if it created a partition beforehand.

This tool is unmaintained for 9 years, so probably some things have changed in the meanwhile.
https://github.com/adafruit/Adafruit-Pi-ExternalRoot-Helper

Oh look, somebody forked it and in the issues of the adafruit repo somebody claims it’s working, so you can try that instead
https://github.com/benjamin-nose/Adafruit-Pi-ExternalRoot-Helper

1 Like

I tried running the command git clone ``git@github.com``:adafruit/Adafruit-Pi-ExternalRoot-Helper.git before, but I got this response:

Cloning into ‘Adafruit-Pi-ExternalRoot-Helper’

error: cannot run ssh: No such file or directory

fatal: unable to fork

This is why I switched to git clone ``https://github.com/adafruit/Adafruit-Pi-ExternalRoot-Helper.git`` from the tutorial.

Did I first have to install that one before I could install the forked version, or is the server for that down for whatever reason? I’m pretty sure that I didn’t make any spelling mistake, considering I checked it multiple times letter for letter.

Edit: shouldn’t git clone ``https://github.com/benjamin-nose/Adafruit-Pi-ExternalRoot-Helper.git work?

Also, I found rsetup. Can I just install that to Flash the SPI, or doesn’t it work without an GUI?

Remove the old folder (the one you cloned from the adafruit repo), then clone from the forked repo, cd into the newly cloned folder and execute the tool

rm -R Adafruit-Pi-ExternalRoot-Helper
git clone https://github.com/benjamin-nose/Adafruit-Pi-ExternalRoot-Helper.git
cd Adafruit-Pi-ExternalRoot-Helper
./adafruit-pi-externalroot-helper
1 Like

Yeah, I for the longest used the “official” Adafruit one…it was bugged and I could NEVER get ahold of the original creator for a fix…then found the benjamin-nose version and it works on multiple SBC’s and multiple distros (both Orange Pi, Rasberry Pi’s, YouYeeToo X1, straight debian linux, the chinese built distro’s, ubuntu, and dietpi, USB drives, SSD’s, NVME drives) and it just works
Just make sure:
A. You leave the SD card in the SBC to “boot” the device (no need to flash the bios/firmware on the board, leave as “boot” from SD option (usually stock default on SBC’s)
B. You make a backup of the SD card with whatever imager software you are comfortable with and keep handy in case it gets corrupted

1 Like

I still get the same error:

root@DietPi:~# rm -R Adafruit-Pi-ExternalRoot-Helper
root@DietPi:~# git clone https://github.com/benjamin-nose/Adafruit-Pi-ExternalRoot-Helper.git 
Cloning into 'Adafruit-P1-ExternalRoot-Helper
remote: Enumerating objects: 66, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 66 (delta 4), reused 7 (delta 4), pack-reused 57 (from 1)
Receiving objects: 100% (66/66), 17.16 K1B | 1.07 MiB/s, done.
Resolving deltas: 100% (27/27), done.
root@DietPi:~# cd Adafruit-Pi-ExternalRoot-Helper
root@DietPi:~/Adafruit-Pi-ExternalRoot-Helper# sudo ./adafruit-pi-externalroot-helper -d /dev/nvme0n1
Target drive = /dev/nvme0n1
[start] will create new ext4 filesystem on /dev/nvmeen1
[start] If there is data on /dev/nvmeeni, it will be lost.
Really proceed? (y)es / (n)o y
[dependencies] Installing gdisk, rsync, and parted.
Reading package lists... 0%
Reading package lists... Done
Buliding dependency tree... Done
Reading state information... Done
gdisk is already the newest version (1.0.10-2+b1).
rsync is already the newest version (3.4.1+ds1-5).
parted is already the newest version (3.6-5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
[fs create] Creating/dev/nvme0n11
[fs create] Creating ext4 filesystem on /dev/nvme0n11
mke2fs 1.47.2 (1-Jan-2025)
The file /dev/nvmme0n11 does not exist and no size was specified.
root@DietPi:~/Adafruit-PI-ExternalRoot-Helper#

I even made sure that the old installation was deleted by running

rm -R Adafruit-Pi-ExternalRoot-Helper
cd Adafruit-Pi-ExternalRoot-Helper
git clone https://github.com/benjamin-nose/Adafruit-Pi-ExternalRoot-Helper.git
cd Adafruit-Pi-ExternalRoot-Helper
sudo ./adafruit-pi-externalroot-helper -d /dev/nvme0n1

and got this response from the first cd command:

-bash: cd: Adafruit-Pi-ExternalRoot-Helper: No such file or directory

So the old installation must have been deleted.

Is the new fork also broken now, or am I not able to download the current version for whatever reason?

OK I see the problem here

export target_partition="${target_drive}1"

It can not handle NVME drives since the partition scheme is different from SATA/USB devices.
On non-NVME you have a device name like /dev/sda and the first partition would be /dev/sda1.
But for NVME the device name is like /dev/nvme0n1 and the first partition is /dev/nvme0n1p1 but the script only appends a 1, which iswrong in your case.

You could just edit that line locally for your script (it’s line 88) and change it to

export target_partition="${target_drive}p1"

so it would work with your NVME drive, but no longer for SATA/USB drives. SOmebody would need to add some logic to detect what type of block device the target drive is.

Here is a one-line-command to change that line for you. When you are in the directory Adafruit-Pi-ExternalRoot-Helper do the following

sed -i 's/${target_drive}1/${target_drive}p1/g' ./adafruit-pi-externalroot-helper

and then run the script again.

2 Likes

Thanks, that did work. The program ran until this line

[boot config] Configuring boot from {/dev/nvme01n1p1}

cp: cannot stat ‘/boot/cmdline.txt’: No such file or directory

That’s expected since in order to boot from the nvme I need to flash the SPI, right?

The line before this was

[fs copy] Copying root filesystem to /dev/nvme0n1p1 with rsync

[fs copy] This will take quite a while. Please be patient

from what I can see from the code, the rest is related to configuring boot as well so it shouldn’t matter to me.

Yea, this is for RPi but you are using a Rock5, so you don’t habe this file.
Anyways, the drive is now clone, youc ancheck with lsblk.

Yes, flash the SPI with u-boot and it should be fine.

I did a simple guide to install dietpi on Rock 5T, maybe may be usefull for some hints!

Actually flashing the spi with the diet pi u-boot (through the dietpi-config) did not work for me, the board was not booting properly. I discovered looking at debug console on UART interface

1 Like