Cloning and restoring APP on NVME help

Hi, I would like to make a clone of my APP partition (in NVME) then restore it.
I tried to expirement with commands in the readme of initrd flashing to try to restore, but all failed.

My system is a Jetson Xavier NX production module (16GB EMMC) on a SEEED A206 carrier, with 128GB NVME.
The rootfs (APP partition) is in the NVME.

Installation

The Xavier was initially installed by flashing the external NVME and QSPI. It was a combination of workflows #3 and #4 in README_initrd_flash.txt. The EMMC does not contain an APP partition, only the external drive has it.
The command I used is:

sudo ADDITIONAL_DTB_OVERLAY_OPT="BootOrderNvme.dtbo" ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 -c ./tools/kernel_flash/flash_l4t_external.xml -p "-c bootloader/t186ref/cfg/flash_l4t_t194_qspi_p3668.xml --no-systemimg" --showlogs  jetson-xavier-nx-devkit-emmc nvme0n1p1

Note that with this command, I used the vanilla configuration flash_l4t_external.xml, which means that the num_sectors was not changed, so it was not correct. But this doesnt matter as the script will correct it.

Cloning

After it was done, I cloned the APP partition (nvme0n1p1) on the Xavier. This was done on the Xavier itself by connecting an external drive, on which the image will be saved. I want to save space so did it using img2simg, which produces a sparse image.
The command I used was:

sudo img2simg  /dev/nvme0n1p1 /mnt/ext_hdd1/system.img.ext

I also took note of the following parameters since I found that these may be needed later:

  • NVME drive sector size (cat /sys/block/nvme0n1/queue/hw_sector_size)
  • NVME drive number of sectors (cat /sys/block/nvme0n1/size)
  • APP partition (nvme0n1p1) size in bytes (sudo blockdev --getsize64 /dev/nvme0n1p1)

Restoring

Now I have a sparse image of the app partition. I know that this image can’t be flashed by flash.sh since it can’t touch external hardware. I tried to use the backup and restore tool l4t_backup_restore.sh but sadly, it can ONLY backup partition in the EMMC partitions.

The only tool that I can use is l4t_initrd_flash.sh.
I tried a bunch of workflows but none worked for me.
What I usually do is:

  1. Generate the image but not flashing it (--no-flash).
  2. Replace system.img and system.img.sha1sum on Linux_for_Tegra/tools/kernel_flash/images/external with the cloned image
  3. Flash it by using sudo ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only

I tried a bunch of stuff, like changing num_sectors in the configuration xml, since I thought flash.idx was not in line with the copied clone system.img.

I don’t know what else to try, please help me! T_T

I also have exactly the same Issue and would love a solution! I’ve also tried replacing Linux_for_Tegra/tools/kernel_flash/images/externa/system.img and had no success for two reasons.

  1. The result is an image which can’t boot. i get a bunch of JBD2: Invalid checksum recovering data block XXXXXX in log messages.
  2. The image flashes at < 2mb/s which results in multi hour flashes and is not useful for production.

Any help would be appreciated.

I tried something again.
I generated images again using --no-flash.
Then copied system.img and sha1sum somewhere.
The I generated the files again with the same command, and then moved the previously copied system.img and sha1sum to tools/kerne_flash/images/external/.

It did not work.

For this, I can tell that l4t_initrd_flash.sh does something to the generated images from the based on the system.img.

L4t_initrd_flash.sh uses flash.sh internally to generate the images.

The thing is you just can’t interfere with its usage of flash.sh, or at least I don’t know how to do that.

This means you just can’t copy your backup system.img to the bootloader folder, because l4t_initrd_flash.sh will instruct flash.sh to rebuild system.img from the rootfs directory.

I’m trying to understand the scripts used but I can only understand a little, I’m not very good with bash scripts.

Please help admin.

This is not a solution for your issue.
But to clone NVMe storages, I use this product.

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