Clone SDCARD to SDD NVMe M2 a complete system

Hey guys

I would like to clone a fully installed and configured Jetson Xavier NX (4.4 production) system from SDCARD to SSD NVMe M2 and make it bootable. Can you point me to the exact tutorial or steps that I have to do to it as fast as possible and as convenient as possible, please ?

Our motivation is to have a faster RW on our IN PPRODUCTION system that currently we have some performance issues and it seems based on profiling that it might be because of slow IO operations.

Thanks

Hello @neilqy60u

You can follow this tutorial:
Changing Storage of the Root File System. [EMMC to M.2 SSD] | Forecr.io

It changes the rootfs from EMMC to M.2 SSD. But the attached script in this blog post should work into your SD card too. It moves the current rootfs in your M.2 SSD.

Regards

First, you can’t make nvme drives bootable. You still need the sdcard with at least the /boot directory on it. In fact, you may want to leave the sdcard fully configured as a backup.

If you tell me the partition layout of your current sdcard I can give you simple instructions on how to clone with just a few commands.

$ parted /dev/nvme0n1 p

Oh, also paste the contents of /boot/extlinux/extlinux.conf and /etc/fstab.

I am just wondering what will be the modus operandi for upgrading the ssd to newer tegra release
We tried just executing sudo apt upgrade it resulted in various inconsintences as we executed it from ssd, not from sdcard. now apt seems kind of affected - can not install packages related to tegra bootloader etc

Hmmm. It should not have affected it at all.
Did the SSD have a separate boot partition or was /boot just a directory in the root filesystem?

My layout on the sdcard and th SSD looks like so…
This assumes the new layout with the nvidia system partitions in the module’s mtd device. If using the old partitioning scheme, just ignore the 19 or so partitions on the sdcard. They need to stay there and aren’t needed on the SSD.

sdcard
part
sdcard
type
sdcard
filesystem
sdcard
device
ssd
part
ssd
type
ssd
filesystem
ssd
device
1 ext4 APP/boot mmcblk0p1 1 ext4 APP/boot sda1
2 ext4 rootfs mmcblk0p2 2 swap swap sda2
3 ext4 rootfs sda3

sda1 is an exact copy of mmcblk0p1 but mmcblk0p1 is actually mounted over it.
sda1 is actually mounted in the ssd’s /mnt/sda1.
sda3 is a copy of mmcblk0p2 and mmcblk0p2 is mounted in the ssd’d /mnt/mmcblk0p1.

The reason for the cross mounts is because mmcblk0p1 is the live boot filesystem because the bootloader still needs the sdcard to boot into. I still want to keep sda1 current as a backup however even though its not actually used by the bootloader. So periodically I copy /boot to /mnt/boot. The same for the root filesystem. In this case, the ssd’s root filesystem (sda3) is the live one but I want to keep the sdcard’s filesystem (mmbclk0p2) current so I periodically copy / to /mnt/mmcblk0p2.

With this arrangement, upgrades shouldn’t be a problem. At least I haven’t had one.

BTW, I created the ssd partitions by…

* booting to the sdcard
* using parted to create the 3 partitions
* mkfs.ext4 -L ssd_boot /dev/sda1
* mkswap -L ssd_swap /dev/sda2
* mkfs.ext4 -L ssd_root /dev/sda3
* mkdir /mnt/sda1 /mnt/sda3
* mount /dev/sda1 /mnt/sda1
* mount /dev/sda3 /mnt/sda3
* rsync -vaHAx /boot/. /mnt/sda1/
* rsync -vaHAx /. /mnt/sda3/
* edit /boot/extlinux/extlinux.conf to add a new entry that points to the sda3 root filesystem and make it the default
* edit /mnt/sda3/etc/fstab to make sure the entry for '/' also points to /dev/sda3 and /boot points to /dev/mmcblk0p1


we got this

Which layout are you using? System partitions on the sdcard or on the module’s flash device?
Which conf file did you use to flash the device to its current state? I.E. jetson-xavier-nx-devkit.conf?

we just used the script from GitHub - jetsonhacks/rootOnNVMe: Switch the rootfs to a NVMe SSD on the Jetson Xavier NX and Jetson AGX Xavier
it leaves the bootloader at sdcard but copies everything to ssd/nvme also sets up service so sdcard forwards to nvme boot

Not for reference, just sharing my own case.

As I have a very low BW internet access so far, downloading JP or SDKM is a pain, so I just flashed a SD card with first L4T version having OTA upgrade support, then installed a 970 EvoPlus SSD into my B02 devkit with NX, created partitions with GPT (made 2 sibling partitions for backup), then cloned rootfs with rsync to NVME SSD, then edited extlinux.conf with a config booting Linux image (and DT if any) from current (emmc) boot, but with rootfs given as Linux boot args providing PARTUUID and adding initramfshooks such as (here from @crazy_yorick ).
Then rebooted my jetson with the new config from extlinux, then renamed /boot to /boot.archive, and made a symbolic link /boot to emmc partition /boot directory, so that l4t-bootloader updates are done in place. I just use /media/user link as this fits my case always logging in GUI, but if not this case, a proper mount from /etc/fstab should do it as well.

So far I’m running happy with this…I’m currently up-to-date running R32.5.1…as long as my NVME SSD is alive, because my SDcard may no longer be able to boot as I can’t keep my SD card up-to-date because of missing room.

I just did DD from sdcard to nvme. or if it is a clean install just flash JP in both.
in the SD_card , /boot/exlinux/exlinux.conf

APPEND ${cbootargs} quiet root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

to boot from SD_card or

APPEND ${cbootargs} quiet root=/dev/nvme0n1p1 rw rootwait rootfstype=ext4 console=ttyTCU0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0

to boot from nvme or ssd.
just if the sd card one get old change and apt.

you need adapt the root=/dev/nvme0n1p1 to your ssd name.

I have no problem in this way.