jetsonhacks / rootOnNVMe

Switch the rootfs to a NVMe SSD on the Jetson Xavier NX and Jetson AGX Xavier
MIT License
395 stars 145 forks source link

jetpack 4.5 support boot from ssd #9

Open diamondbarcode opened 3 years ago

diamondbarcode commented 3 years ago

Hi, do you plan to update code to support the new way to boot in jetpack 4.5?

smyeungx commented 3 years ago

@diamondbarcode

I tried the setssdroot package on a new installation of L4T Jetpack 4.5 on NX. The scripts can rsync all the files and setup the service, and boot and mount the NVME after restart. Do you encounter any problems? Do you want to use it on a NX or AGX?

Best, Simon

smyeungx commented 3 years ago

FYI.

image

diamondbarcode commented 3 years ago

in jetpack 4.5 there is a permanent solution to this but I don't understand the instruction well. This hack may counter problems when there is an OTA update.

smyeungx commented 3 years ago

Hi,

I have tried to install Jetpack 4.5 directly using sdkmanager to NVME. Seems it can flash directly to NMVE, but it got stuck during the TCP connection stage.

I have tried a reverse approach in the following order (with modified copy-rootfs-ssd.sh):

Seems it's working (experimental) in typical apt-get update/upgrade and copy all data back to micro-sd card. I didn't try with major OTA update.

Best, Simon

diamondbarcode commented 3 years ago

how to flash directly to NVME form dsk manager? when I try mine I have no option where to flash

smyeungx commented 3 years ago

I have inserted the NVME only without the micro-SD. The sdkmanager got stuck after upload the JetPack. I suspect whether the sdkmanager actually did the job. If you don't mind, let me finished my current project on NX in the coming week. Then I try to document it a bit and get back to you?

Generally, this package work pretty well and the NVME is much much faster than micro-SD especially if you need to buffer/stream massive amount of video data (in my case)

smyeungx commented 3 years ago

@diamondbarcode

I have touched up the NVME->SD card sync (experimental) script (from original copy-rootfs-ssd.sh):

#!/bin/bash

# Check SD card and NVME mountpoint SD_MOUNTPOINT=$(findmnt /dev/mmcblk0p1 --output=target -n) NVME_MOUNTPOINT=$(findmnt /dev/nvme0n1p1 --output=target -n)

# If SD card is mounted as / and NVME is not mounted # sync SD card to NVME if [ "$SD_MOUNTPOINT" == "/" ] && [ -z "$NVME_MOUNTPOINT" ]; then echo "rsync SD card to NVME" # Mount the SSD as /mnt sudo mount /dev/nvme0n1p1 /mnt # Copy over the rootfs from the SD card to the SSD sudo rsync -axHAWX --numeric-ids --info=progress2 --exclude={"/dev/","/proc/","/sys/","/tmp/","/run/","/mnt/","/media/*","/lost+found"} / /mnt # We want to keep the SSD mounted for further operations # So we do not unmount the SSD fi

# If NVME is mounted as / and SD card mounted # sync NVME to SD card if [ "$NVME_MOUNTPOINT" == "/" ]; then echo "rsync NVME to SD card" # If SD card is not mounted, mount it if [ -z "$SD_MOUNTPOINT" ]; then SD_MOUNTPOINT="/mnt/sdcard" sudo mkdir "$SD_MOUNTPOINT" sudo mount /dev/mmcblk0p1 "$SD_MOUNTPOINT" fi sudo rsync -axHAWX --numeric-ids --info=progress2 --exclude={"/dev/","/proc/","/sys/","/tmp/","/run/","/mnt/","/media/*","/lost+found"} / "$SD_MOUNTPOINT" fi

satyajitghana commented 3 years ago

I just tested on a fresh JetPack 4.5 Flash Install on a Xavier NX, works like a charm :)