Giter Site home page Giter Site logo

rootonusb's Introduction

rootOnUSB

Set rootfs to be on a USB drive

Original article on JetsonHacks: https://wp.me/p7ZgI9-317

WARNING: This is a low level system change. You may have issues which are not easily solved. You should do this working on a freshly flashed micro SD card, and certainly do not attempt this with valuable data on the card itself. Assume that if this does not work, you may have to flash the micro SD card again. A serial debug console is useful if things go wrong.

The scripts in this repository will setup a NVIDIA Jetson Nano Developer Kit to set the rootfs to a USB drive. This involves four steps. NOTE: This procedure is significantly different than the previous release of this repository. This version does not require the kernel to be recompiled, saving about 40 minutes of install time.

Step 1

Build the initramfs with USB support, so that USB is available early in the boot process. A convenience script named addUSBToInitramfs.sh provides this functionality.

$ ./addUSBToInitramfs.sh

Step 2

The second step does not have representation here. The user must prepare a USB drive (preferably USB 3.0, SSD, HDD, or SATA->USB) by formatting the disk as ext4 with a partition. It is easier if you only plug in one USB drive during this procedure. When finished, the disk should show as /dev/sda1 or similar. Note: Make sure that the partition is ext4, as NTSF will appear to copy correctly but cause issues later on. Typically it is easiest to set the volume label for later use during this process.

Step 3

Copy the application area of the micro SD card to the USB drive. copyRootToUSB.sh copies the contents of the entire system micro SD card to the USB drive. Naturally, the USB drive storage should be larger than the micro SD card. Note: Make sure that the USB drive is mounted before running the script. In order to copyRootToUSB:

usage: ./copyRootToUSB.sh [OPTIONS]

  -d | --directory     Directory path to parent of kernel

  -v | --volume_label  Label of Volume to lookup

  -p | --path          Device Path to USB drive (e.g. /dev/sda1)

  -h | --help  This message

Step 4

Modify the /boot/extlinux/extlinux.conf file. An entry should be added to point to the new rootfs (typically this is /dev/sda1). There is a sample configuration file: sample-extlinux.conf

You should make a backup of the original extlinux.conf file. Also, when you edit the file you should make a backup of the original configuration and relabel the backup. This will allow you to access an alternate boot method from the serial console in case something goes sideways.

Then you should changed the INITRD line to:

INITRD /boot/initrd-xusb.img

So that the system uses the initramfs that we built that includes the USB firmware. Then set the root to the USB drive.

Here are some examples. You can set the drive by the UUID of the disk drive, the volume label of the drive, or the device path:

APPEND ${cbootargs} root=UUID=0e437280-bea0-42a2-967f-a240dd3075eb rootwait rootfstype=ext4
APPEND ${cbootargs} root=LABEL=JetsonNanoSSD500 rootwait rootfstype=ext4
APPEND ${cbootargs} root=/dev/sda1 rootwait rootfstype=ext4

The first entry is most specific, the last most generic. Note that you are not guaranteed that a USB device is enumerated in a certain order and will always have the same device path. That is, if you leave another USB drive plugged in along with your root disk when you boot the Jetson, the root disk may have a different path than originally, such as /dev/sdb1.

Also, there is a convenience file: diskUUID.sh which will determine the UUID of a given device. This is useful for example to determine the UUID of the USB drive. Note: If the UUID returned is not similar in length to the above example, then it is likely that the device is not formatted as ext4.

$ ./diskUUID.sh

While this defaults to sda1 (/dev/sda1), you can also determine other drive UUIDs. The /dev/ is assumed, use the -d flag. For example:

$ ./diskUUID.sh -d sdb1

You may find this information useful for setting up the extlinux.conf file

Release Notes

November, 2019

  • Jetson Nano
  • L4T 32.2.3
  • Linux kernel 4.9-140
  • No changes, release only to match L4T

September, 2019

  • Jetson Nano
  • L4T 32.2.1 (JetPack 4.2.2)
  • Linux kernel 4.9.140
  • Change from recompiling kernel to include the tegra-xusb driver, to adding the tegra-xusb to initramfs. This allows access to the usb driver early on in the boot process.

July, 2019

  • Initial Release
  • Jetson Nano
  • L4T 32.2 (JetPack 4.2.1)
  • Linux kernel 4.9.140

April, 2019

  • Initial Release
  • Jetson Nano
  • L4T 32.1.0 (JetPack 4.2)
  • Linux kernel 4.9.140

rootonusb's People

Contributors

dosvidos avatar jetsonhacks avatar jetsonhacksnano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rootonusb's Issues

How much space does it require?

I am using a 16gb SD Card that I had when I purchased the Nano. As soon as I saw your video, I decided to use a 120gb SSD as the root storage for the Nano. However, the kernel build failed saying no space left on device (this happened on the last step, while copying the Image file). Approximately how much space does the kernel need in case of Jetson Nano?

[SOLVED] Jetson-Nano USB SSD dont' move.. please fix it..

This is the error I got when following the instructions to build the kernal. I Want to confirm that I do have a jetson nano and I had it rooted to run on USB SSD until I decided to upgrade to the new Jetpack 4.2 now suddenly I am getting this "jetson Board Mismatch" issue which is not making any sense.

jetson1@jetson1-desktop:~/rootOnUSB$ ./buildKernel.sh
Jetson Model: NVIDIA Jetson Nano Developer Kit
Jetson L4T:
==== Jetson Board Mismatch! =============
Currently this script works for the jetson-nano.
This processor appears to be a NVIDIA Jetson Nano Developer Kit, which does not have a corresponding script

Exiting
jetson1@jetson1-desktop:~/rootOnUSB$

4.2.0 old version same error

Support of L4T R32.5.1 ?

Dear,

I use the latest version of rootOnUSB and follow the README and Videos but after I reboot the system to start from USB drive, the starts fail because no /dev/sda was found.

I use an SSD installed in a Geekworm Jetson Nano T300 expansion adapter with Jetson L4T R32.5.1 .

Any suggestions or hints?

Thanks in advance, Andreas

Jetson NX module

Hello,
Can i apply this process in jetson NX module?
Not dev kit, i have jetson nx module + EN715 carrier board by AverMedia corp.

I want find solution NX run on ssd by connecting sata to usb cable.
i tried https://github.com/jetsonhacks/rootOnNVMe
i edit /dev/nvme0n1p1 to /dev/sda1 in any script cause ssd device have that name. But it isn't works.
i'm not good at english so i'm sorry.

Please reply.
Thanks.

extlinux.conf

After modifying extlinux.conf to change boot drive, device(Jetson Nano Developement Board with JetPack 4.2.1 installed) failed to boot fully. USB drivers loaded fine I think, but failed to switch over boot to USB drive. On the previous Jetpack deployment I had 0 issues with switching to usb rootfs. Also by the way cool guitar playing. ) EDIT 8/31/19 Also the build was done on fresh install no updates and a blank usb nvme drive (same equipment used previously)

M.2 nvme

Hi,
Can i use this approach to run from nvme card?

Thanks
Luigi

I get an error.

Hello,

./addUSBToInitramfs.sh
Adding USB to initramfs
Warning: couldn't identify filesystem type for fsck hook, ignoring.
I: The initramfs will attempt to resume from /dev/zram3
I: (UUID=d123a4c6-67e7-4e41-91f8-19eb8aed2b66)
I: Set the RESUME variable to override this.
/sbin/ldconfig.real: Warning: ignoring configuration file that cannot be opened: /etc/ld.so.conf.d/aarch64-linux-gnu_EGL.conf: No such file or directory
/sbin/ldconfig.real: Warning: ignoring configuration file that cannot be opened: /etc/ld.so.conf.d/aarch64-linux-gnu_GL.conf: No such file or directory

what am I supposed to do?

Thank you.

Install fail: bzip2 unzip error / kernel config fail

Hi - firstly: thank you for providing this!

I tried to install this and ran into a number of issues:

1 - when running ./buildKernel.sh the script fails. Apparently there is an issue with bzip2 on the nano (at least on mine): uncompressing the kernel sources yields an EOF (bzip2: Compressed file end unexpectedly) error. I ran into this error both using the command line as well as GUI (using the file browser) on 2 distinct installations.
As a workaround I unzipped the kernel sources on my Mac and continued...

2 - make menuconfig fails. Sorry, I am writing this from memory, please bear with me for not being as accurate as I should be here: as far as I recall it is an issue with a wifi driver which has been removed, but is still referenced somewhere.
I found a couple of comments on Nvidias developer forums confirming the issue, but without providing a solution.
I also downloaded an allegedly updated kernel but still no luck.

Recommendation: Linux swap partition in addition to the system partition on USB drive

Thanks for the instructions on how to move the root partition of the Jetson Nano to a USB drive. It works perfectly for me (July 2020). One note: In step two I would recommend to create a Linux swap partition in addition to the system partition. The performance of a swap partition on a USB SSD drive is much better (and more reliable in the long run) than the standard swap areas on the SD card. When memory is running low (happens fast with only 4 GB RAM), this makes a big difference.

After reboot the SD card swap areas can be disabled with the following shell command:

sudo swapoff -a

And then the new swap partition can be activated:

sudo swapon -U {UUUID of the newly created swap partition}

Of course the new swap configuration can also be set up permanently.

on B01 board, usb power is not switched on [BUG]

Describe the issue
using B01 nano board with jetpack 4.4, the usb power is not switched on till after the transfer of root is attempted. verified with serial console, and USB led power light.

tried powering the USB device (nvme ssd, external 2.5" harddrive, and usb stick) from external source, still, the USB port appears not enabled

NVIDIA Jetson Hardware

  • [ X] Jetson Nano B01
    Other:

L4T / JetPack Version
4.4.1

** Software version**
used the rootOnUSB scripts

To Reproduce
run rootOnUSB scripts with USB storage device

Expected behavior
USB the enable before /boot/extlinix/ectlinux.conf is executed

Additional context
tested through serial console, when choosing the USB device from boot options, the USB device receives no power

[BUG] Important details missing from README.md

Describe the issue
Describe the issue that you are having.

I have tried following the guide to get my nano booting off USB but it didn't work. There are a few potential reasons for this.

Before I get into the issues, there is one important detail missing from this guide/hack, which should be mentioned at the start. After completing this hack, should the user be able to boot L4T directly off the USB drive or will they still need the microSD card inserted? I believe it is the latter but I'm hoping I'm wrong!

The main problem with the guide is that Step 3 is very vague. It doesn't explain the command very well and it should really give an example. I think it intends the user to do something like this, presuming that sda1 has been formatted as ext4 already:

$ sudo mount /dev/sda1 /mnt
$ ./copyRootToUSB.sh -d /mnt

I have my doubts about copyRootToUSB.sh because it doesn't use sudo for the rsync command and I think it should - the regular user not having permission to access all of the files on the disk being copied.

NVIDIA Jetson Hardware

  • [ X] Jetson Nano
    Other:

L4T / JetPack Version

JetPack 4.4

** Software version**
Please list the relevant software versions, for example OpenCV

To Reproduce
For example, what command line did you run?

In Step 3, I ran:

$ sudo mount /dev/sda1 /mnt
$ ./copyRootToUSB.sh -d /mnt

Expected behavior

The README/guide should include example commands in step 3 for mounting the disk and using
copyRootToUSB.sh. Also, this script should the changed to run rsync with sudo so that every file gets copied.

How to backup USB drive?

Hi, sorry to have a side question!

I tried to backup and restore the rootOnUSB drive but I failed. The system won't start. Do you have any recommendation how to backup the USB drive? Thanks a lot!

Backup
sudo tar -cvpzf jetson_nano_usb.tar.gz --one-file-system /media/nano/rootOnUSB/
Restore
sudo tar -xvpzf jetson_nano_usb_ros_realsense.tar.gz -C /media/nano/rootOnUSB --numeric-owner

[ENHANCEMENT]

Is there a migration path from JP4.4 to new JP4.5 with new bootloader support ?
Do I have to install with JP 4.5 from scratch and restore my development files ?

RootOnUSB Not working on new Jetpack 4.2 that was release july 19, 2019

After installing the new Jetpack 4.2, it is no long possible to root the jetson nano on a faster USB SSD drive as described on this video on jetson hack.com

https://www.jetsonhacks.com/2019/04/25/jetson-nano-run-on-usb-drive/

This is the error I got when following the instructions to build the kernal. I Want to confirm that I do have a jetson nano and I had it rooted to run on USB SSD until I decided to upgrade to the new Jetpack 4.2 now suddenly I am getting this "jetson Board Mismatch" issue which is not making any sense.

jetson1@jetson1-desktop:~/rootOnUSB$ ./buildKernel.sh
Jetson Model: NVIDIA Jetson Nano Developer Kit
Jetson L4T:
==== Jetson Board Mismatch! =============
Currently this script works for the jetson-nano.
This processor appears to be a NVIDIA Jetson Nano Developer Kit, which does not have a corresponding script

Exiting
jetson1@jetson1-desktop:~/rootOnUSB$

Does anyone have the work around for this? HOW can I root my jetson nano to run on USB SSD with Jetpack 4.2?

Jetson Board Mismatch

`jetbot@jetbot:$ cd rootOnUSB/
jetbot@jetbot:
/rootOnUSB$ ./buildKernel.sh
Jetson Model: jetson-nano
Jetson L4T: 32.1.0
Installing buildModulesAndKernel
Cloning into '/home/jetbot/buildKernelAndModules'...
remote: Enumerating objects: 69, done.
remote: Counting objects: 100% (69/69), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 69 (delta 39), reused 51 (delta 27), pack-reused 0
Unpacking objects: 100% (69/69), done.
Proposed source path: /usr/src/kernel/kernel-4.9
Jetson Model: jetson-nano
Getting L4T Version
Jetson BSP Version: L4T R32.1.0
Jetson_L4T=32.1.0
==== Jetson Board Mismatch! =============
Currently this script works for the NVIDIA Jetson Nano Developer Kit.
This processor appears to be a jetson-nano, which does not have a corresponding script

Exiting
jetbot@jetbot:~/rootOnUSB$ `

Would you please take a look on this error? I am already using the vL4T32.1 release. I am using the image downloaded from JetBot WIKI website. Thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.