본문 바로가기

NVIDIA Jeston/Jetson BSP

[Jetson] nvme ssd 를 루트파일시스템으로 사용하기

Jeston 에서 nvme ssd 를 루트파일시스템으로 사용하기

NVIDIA Xavier NX devkit (emmc module) 의 내장 emmc disk 공간은 16GB 이고, root file system 용도로 사용할 수 있는 공간은 약 14GB 이다. emmc module 의 disk 공간이 부족하기 때문에 root file system 을 SD 카드 또는 nvme ssd 로 이동할 수 있다.

NVIDIA Xavier NX devkit 에서 jetsonhack 에서 제공하는 script 를 사용하여 root file system 을  nvme ssd 로 이동한다.

nvme ssd 루트파일시스템

테스트 환경

  • NVIDIA Xavier NX devkit (16G emmc module)
  • Jetpack 4.6 (L4T R32.6.1)
  • nvme ssd root file system 사용

nvme ssd 루트파일시스템 생성

터미널에서 fdisk 명령으로 nvme 의 기존 파티션을 지우고 새로 생성한다.

 

nvidia@linux:~$ sudo fdisk /dev/nvme0n1
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The old ext4 signature will be removed by a write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x378bd86f.

Command (m for help): d
No partition is defined yet!
Could not delete partition 367383999489

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p):

Using default response p.
Partition number (1-4, default 1):
First sector (2048-250069679, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-250069679, default 250069679):

Created a new partition 1 of type 'Linux' and of size 119.2 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

터미널에서 mkfs 명령으로 생생된 파티션을 ext4로 포멧한다.

nvidia@linux:~/rootOnNVMe$ sudo mkfs.ext4 /dev/nvme0n1p1
mke2fs 1.44.1 (24-Mar-2018)
Discarding device blocks: done
Creating filesystem with 31258454 4k blocks and 7815168 inodes
Filesystem UUID: aea3de37-4080-4c57-ae8d-87cfba79620e
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done
Writing inode tables: done
Creating journal (131072 blocks): done
Writing superblocks and filesystem accounting information: done

 jetsonhack 에서 제공하는 script 를 사용하기 위해 git 를 복제한다. copy-rootfs-ssd 스크립트를 실행하여 emmc 를 nvme ssd 로 복사한다.

$ git clone https://github.com/jetsonhacks/rootOnNVMe.git
$ cd rootOnNVMe/
rootOnNVMe$ ./copy-rootfs-ssd.sh

setup-service 스크립트를 실행하여 nvme ssd 로 root file system 을 마운트 하는 service 를 추가한다.

nvidia@linux:~/rootOnNVMe$ ./setup-service.sh
==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ===
Authentication is required to reload the systemd state.
Authenticating as: nvidia
Password:
==== AUTHENTICATION COMPLETE ===
Created symlink /etc/systemd/system/default.target.wants/setssdroot.service → /etc/systemd/system/setssdroot.service.
Service to set the rootfs to the SSD installed.
Make sure that you have copied the rootfs to SSD.
Reboot for changes to take effect.

nvme ssd 루트 파일 시스템 테스트

재부팅 후에 다음과 같에 nvme 에 루트 (/) 가 mount 되어 있는지 확인한다.

nvidia@linux:~$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
none             3591108       0   3591108   0% /dev
tmpfs            3975796      40   3975756   1% /dev/shm
tmpfs            3975796   29824   3945972   1% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs            3975796       0   3975796   0% /sys/fs/cgroup
/dev/nvme0n1p1 122547144 7035184 109243888   7% /
tmpfs             795156     104    795052   1% /run/user/1000
/dev/mmcblk0p1  14384136 6103448   7530304  45% /media/nvidia/e8776fb6-cda1-46d1-89a5-f486c20fa298

참고자료

jetsonhacks github 를 참고한다.

https://github.com/jetsonhacks/rootOnNVMe.git

 

GitHub - jetsonhacks/rootOnNVMe: Switch the rootfs to a NVMe SSD on the Jetson Xavier NX and Jetson AGX Xavier

Switch the rootfs to a NVMe SSD on the Jetson Xavier NX and Jetson AGX Xavier - GitHub - jetsonhacks/rootOnNVMe: Switch the rootfs to a NVMe SSD on the Jetson Xavier NX and Jetson AGX Xavier

github.com