How to backup and restore nvme with Jetson Orin nx

I can see the method in this link How to clone Orin NX APP partition to host PC - #6 by lhoang
But there is no system.img.
if I want to flash the orin nx at another place. How to do it?

Hi,

Please refer to the README file in Linux_for_Tegra/tools/backup_restore.

That’s expected because you do backup and restore with the same script, instead of other tools like flash.sh or initrd flash.

I see the tools/backup_restore/images. Can I tar the images and place them to the other PC with the path tools/backup_restore/images ?

I find that flash.sh just can be used in internal store but orin nx just has SSD.
How to use initrd flash

Ideally YES.
You use the -b option for backup, and then you use the -r option for restore.
That’s all you need.

1 Like

Hello,I can resotre the images. Here is the log.

Waiting for target to boot-up...
Waiting for device to expose ssh ......RTNETLINK answers: File exists
RTNETLINK answers: File exists
Device has booted into initrd. You can ssh to the target by the command:
$ ssh root@fe80::1%enxc25268f30f2a
Cleaning up...
Log is saved to Linux_for_Tegra/initrdlog/flash_1-10_0_20231102-091852.log 
Run command: 
ln -s /proc/self/fd /dev/fd && mount -o nolock [fc00:1:1::1]:/home/alfred/nvidia_docker/nvidia/nvidia/nvidia_sdk/JetPack_5.1.1_Linux_JETSON_ORIN_NX_TARGETS/Linux_for_Tegra/tools/backup_restore /mnt && /mnt/nvrestore_partitions.sh -n 
 on root@fc00:1:1::2
/mnt/images ~
nvrestore_partitions.sh: Use the default nvpartitionmap.txt as the index file.
partx: specified range <1:0> does not make sense

UART is the following.

insmod /lib/modules/5.10.104-tegra/kernel/drivers/mtd/mtd.ko 
insmod /lib/modules/5.10.104-tegra/kernel/drivers/mtd/devices/qspi_mtd.ko 
[    8.257540] qspi_mtd spi6.0: MX25U51279G (65536 Kbytes)
[    8.257678] qspi_mtd spi6.0: mtd .name = spi6.0, .size = 0x4000000 (64MiB) .erasesize = 0x00010000 (64KiB) .numeraseregions = 0
[    8.261969] 1 fixed-partitions partitions found on MTD device spi6.0
[    8.262124] Creating 1 MTD partitions on "spi6.0":
[    8.264710] 0x000000000000-0x000004000000 : "Whole_flash0"
insmod /lib/modules/5.10.104-tegra/kernel/drivers/spi/spi-tegra210-qspi.ko 
insmod /lib/modules/5.10.104-tegra/kernel/drivers/hwmon/pwm-fan.ko 
[    8.293161] using random self ethernet address
[    8.293274] using random host ethernet address
[    8.295823] Mass Storage Function, version: 2009/09/11
[    8.296793] LUN: removable file: (no medium)
[    8.302260] LUN: removable file: (no medium)
[    8.306609] LUN: removable file: (no medium)
[    8.312335] rndis0: HOST MAC c2:52:68:f3:0f:2a
[    8.314560] rndis0: MAC f2:f7:8a:07:3a:71
[    8.320807] tegra-xudc 3550000.xudc: EP 0 (type: ctrl, dir: out) enabled
[    8.854166] tegra-xudc 3550000.xudc: EP 5 (type: intr, dir: in) enabled
[    8.854369] tegra-xudc 3550000.xudc: EP 3 (type: bulk, dir: in) enabled
[    8.854573] tegra-xudc 3550000.xudc: EP 2 (type: bulk, dir: out) enabled
[    8.854827] IPv6: ADDRCONF(NETDEV_CHANGE): rndis0: link becomes ready
[    8.854940] tegra-xudc 3550000.xudc: EP 7 (type: bulk, dir: in) enabled
[    8.855221] tegra-xudc 3550000.xudc: EP 4 (type: bulk, dir: out) enabled
[    8.865998] mmc1: SDHCI controller on 3400000.sdhci [3400000.sdhci] using ADMA 64-bit
[    9.358482] random: crng init done
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
bash-5.0# 
bash-5.0# 
bash-5.0# 
bash-5.0#

Here is my images.

ll tools/backup_restore/images/
总计 11769836
drwxr-xr-x 3 root root        4096 10月 31 11:34 ./
drwxr-xr-x 3 root root        4096 10月 31 11:12 ../
-rw-r--r-- 1 root root       16896 10月 31 11:12 gptbackup.img
-rw-r--r-- 1 root root       20480 10月 31 11:12 gptmbr.img
-rw-r--r-- 1 root root     1372219 10月 31 11:34 nvme0n1p10_bak.img
-rw-r--r-- 1 root root      327584 10月 31 11:34 nvme0n1p11_bak.img
-rw-r--r-- 1 root root      365939 10月 31 11:34 nvme0n1p12_bak.img
-rw-r--r-- 1 root root        4608 10月 31 11:34 nvme0n1p13_bak.img
-rw-r--r-- 1 root root      292755 10月 31 11:34 nvme0n1p14_bak.img
-rw-r--r-- 1 root root 11908812152 10月 31 11:25 nvme0n1p1.tar.gz
-rw-r--r-- 1 root root    23237616 10月 31 11:34 nvme0n1p2_bak.img
-rw-r--r-- 1 root root       77281 10月 31 11:34 nvme0n1p3_bak.img
-rw-r--r-- 1 root root      146388 10月 31 11:34 nvme0n1p4_bak.img
-rw-r--r-- 1 root root    23237616 10月 31 11:34 nvme0n1p5_bak.img
-rw-r--r-- 1 root root       77281 10月 31 11:34 nvme0n1p6_bak.img
-rw-r--r-- 1 root root      146388 10月 31 11:34 nvme0n1p7_bak.img
-rw-r--r-- 1 root root    26935644 10月 31 11:34 nvme0n1p8_bak.img
-rw-r--r-- 1 root root       77281 10月 31 11:34 nvme0n1p9_bak.img
-rw-r--r-- 1 root root        1816 10月 31 11:34 nvpartitionmap.txt
-rw-r--r-- 1 root root    67108864 10月 31 11:12 QSPI0.img
drwxr-xr-x 3 root root        4096 10月 31 11:12 tmp/

Here is my command sudo ./tools/backup_restore/l4t_backup_restore.sh -r jetson-orin-nano-devkit

You need to use -e to specify the storage device, which is -e nvme0n1 in your case.

./tools/backup_restore/l4t_backup_restore.sh: 非法的选项 -- e
Usage: l4t_backup_restore.sh -b [ -c ] <board-name> 
       l4t_backup_restore.sh -r <board-name> 

	This script creates a backup image of a Jetson device or restores a Jetson device using a backup image.

	This script should be run inside initramfs.

	Options:
		<board-name>                 Indicate which board to use.
		-u <PKC key file>            PKC key used for odm fused board.
		-v <SBK key file>            SBK key used for encryptions
		-h | --help : Display this message
		-b : Generate the backup image and store it in /home/alfred/nvidia_docker/nvidia/nvidia/nvidia_sdk/JetPack_5.1.1_Linux_JETSON_ORIN_NX_TARGETS/Linux_for_Tegra/tools/backup_restore/images
		-r : Restore the backup image from /home/alfred/nvidia_docker/nvidia/nvidia/nvidia_sdk/JetPack_5.1.1_Linux_JETSON_ORIN_NX_TARGETS/Linux_for_Tegra/tools/backup_restore/images
		--raw-image ---------------- Specify the path of the raw disk image to be restored into storage devce.

No this param It’s jp5.1.1

OK, I just saw you try this:

The -e option is only available on 5.1.2.

Have you tried with a different USB cable?

NO, because I can flash the image with sdkmanager.

I followed these steps.

sudo sed -i "s/mmcblk0p1/internal/g" tools/backup_restore/l4t_backup_restore.sh
sudo sed -i "s/mmcblk0/nvme0n1/g" tools/backup_restore/nvbackup_partitions.sh
sudo sed -i "s/mmcblk0/nvme0n1/g" tools/backup_restore/nvrestore_partitions.sh
sudo ./tools/backup_restore/l4t_backup_restore.sh -b jetson-orin-nano-devkit
sudo ./tools/backup_restore/l4t_backup_restore.sh -r jetson-orin-nano-devkit

I just verified the same workflow as you did, and it worked.
Therefore, I’d suggest trying different storage devices/USB cables.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.