Clone one NVMe and flash onto other jetson xavier nx

Hello, I’m currently working on setting up a bunch of custom things on an NVMe SSD on a jetson-xavier-nx-emmc. I would like to be able to clone all of nvme0n1p1 and flash this onto the other devices for my team. As far as I have been able to research, there is no efficient way to do so. I know the usual ./flash.sh script can’t reach the external NVMe drive when trying to clone or flash. I have seen several posts about using the ./tools/kernal_flash/l4t_initrd_flash.sh script, but everyone seems to run into multiple problems there as well. Is anyone able to give me some instructions for:

  1. Creating an image of the nvme0n1p1 (Very large partition)
  2. Flashing this image onto the nvme0n1p1 of a different jetson-xavier-nx-emmc

Thank you in advance

Hi,

we do have an official way to clone NVMe SSDs, and refer to

/Linux_for_Tegra/tools/backup-restore/README_backup_restore.txt

for detailed instructions.

Note that currently you have to manually replace mmcblk0 with nvme0n1 in nvbackup_partitions.sh and nvrestore_partitions.sh for this method to work with NVMe SSDs. We’ll add an option for users to select which storage device to clone in the upcoming L4T release.

Thank you! I will do some testing and try to get this to work. For now I’ll mark as a solution.

@DaveYYY
Hello,
I tried altering the nvbackup_partitions.sh script to change all instances of mmcblk0 with nvme0n1. However, I was receiving a message that said Mount: Unrecognized filesystem type ‘swap’. I have the NVMe set up with 16GB of free space, and the rest of it is an ext4 linux filesystem partition in nvme0n1p1. I’m unsure how to fix this issue with the scripts in tools/backup-restore/.
Do you have any advice?
Thank you.

Hi,

so you have swap enabled as a dedicated partition on your SSD? Then you may have to disable it first.

What do you have with lsblk?

Hello,

I don’t believe that swap is enabled on any partition of this SSD. Here is the output of lsblk.
lsblk.txt (1.2 KB)

Hi,

Let us leave alone the question of swap.
I just noticed that your rootfs resides in the eMMC, then backing up your SSD with our tool would be of no use.
Like, what’s inside your nvme0n1p1? If it does not contain the rootfs, it’s not going to boot any other devices.

You should use other tools on Linux that can clone partitions on disks.
Am I missing anything here?

Sorry for the confusion. I currently have the rootfs on the eMMC internal. That is because I was manually copying over the /dev/nvme0n1p1 image file using dd. For our devices, we do want to boot from the NVMe and have the rootfs on nvme0n1p1. The way we have been setting up the NVMe as rootfs is using the github repo rootOnNVMe. I am open to other ways to set the NVMe as the rootfs if you have information on this.
I apologize for being a bit confused. This is my first experience with Jetson products.

Hi,

I’m not sure, but maybe the swap issue is related to the rootOnNVMe tool you used.
We do provide ways of directly flashing into NVMe SSDs, and you could refer to Workflow 4 in Linux_for_Tegra/tools/kernel_flash/README_initrd_flash.txt.

Try something like:

sudo ./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” --network usb0
jetson-xavier-nx-devkit-emmc external

Okay thank you! I will do some more testing and see what I can find out. For the command above, this is to directly flash the rootfs onto the NVMe drive?
Just to see if I’m understanding correctly. With a fresh xavier nx device, I would follow this procedure:

  1. Use l4t_initrd_flash.sh to flash rootfs to NVMe
  2. Use nvbackup_partitions.sh to create an image of that NVMe drive.
  3. Use nvrestore_partitions.sh to flash the copied image onto a different NVMe drive

Am I understanding correctly?

Yes, so you don’t have to first flash into eMMC, and do all the bothering stuff to boot from NVMe.

I think you are right about it.
Just to note that nvbackup_partitions.sh and nvrestore_partitions.sh are the underlying scripts that are actually running, but you’d use l4t_backup_restore.sh as kind of like an interface.

Okay thank you for all the help! I will hopefully get a chance to test today. If not, I will test next week and update if this solution works for me.

Hello @DaveYYY,
Thank you for the help! This solution works for me.

1 Like

Hello, I had a quick question about this command. Does this set up the Jetson Xavier NX to boot from the NVMe? I pulled out a brand new Xavier NX and attempted to flash with this command. However, the rootfs was still on the internal eMMC.

Hi,

you may still need to manually select the storage device to boot from.
For r32.x, modify extlinux.conf to point to the new root,
for r35, enter UEFI boot menu and change the boot order.

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