Jetson Orin Nano nvme system backup and restore

        Hello everyone, I'm Brother Hu, Jeston Orin nano 8G module, I have also played for a while, after configuring a lot of environments, I am thinking about how to restore the system on the new module after taking it out like the previous module . The process is tortuous, and the result is also tortuous. Orin nano does inherit some of the styles of NANO. These are not very friendly. Here are two methods for you. One is that I have painted it myself for several days and repeated verification. It is feasible. Yes, the other one is that I have used the SD card system on the nano before, and I think it should be feasible, but the equipment corresponding to NVME storage is too expensive. Anyway, after a trip, I don’t feel very good overall!

Table of contents

1. Preliminary preparation

2. Use initrd to back up the file system

3. Burn the backup system to the new NVME storage

4. Local tyrant version plan


1. Preliminary preparation

Get your own kit ready first.

         I use Weixue's carrier board myself, and the core module uses an 8G module without an SD card. The official version is with an SD card holder, pay attention to the difference.

        Secondly, your development kit has already programmed the system to NVME, and the default boot is also booted from NVME.

        Finally, you need to find an NVME storage of the same size as your development conditions. It is recommended to use the same model, and the storage size needs to be consistent one-to-one. This is very important. Anyway, I have not found a solution to restore the large storage to the small storage. Of course, there is no problem in restoring the small storage to the large storage. That is to say, if you meet these two conditions, you can start the following method.

  • The NVME storage size of the carrier board should be smaller than the disk where you store the backup system

  • The storage size of the restored NVME empty disk must be greater than or equal to the previously backed up storage

So, to summarize, you need to prepare a general list of materials as shown in the figure below.

2. Use initrd to back up the file system

The development kit is programmed and connected to the USB cable, and then the module recovery mode starts

 If you use a virtual machine on your PC, then at this time, your computer will have an access option

 Then lsusb can see the ID of the device access.

         Of course, since you already have a system at this time, you can enter the recovery mode by software, log in to the terminal of your module, and enter the following command.

sudo reboot --force forced-recovery

On your host, after entering the programming environment, enter the following command, and the module will start and stop at the initrd position.

$ cd Linux_for_Tegra
$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --initrd <board-name> <rootdev>
#The command we actually use (onboard NVME system)
sudo ./tools/kernel_flash/l4t_initrd_flash.sh --initrd --flash-only jetson-orin-nano-devkit nvme0n1p1
# The command we actually use (onboard USB storage system)
sudo ./tools/kernel_flash/l4t_initrd_flash.sh --initrd --flash-only jetson-orin-nano-devkit sda1

 When the above print appears, remember to disconnect the recovery jumper.

 If you're using a virtual machine, you'll be prompted once here to opt in.

 At this point, the module has stopped at the initrd position, and you need to manually operate it later.

Enter commands on the host side as prompted.

#SSH登录模块
ssh root@fc00:1:1:0::2
#密码
root

 For the first connection, you generally need to generate a secret key. Enter yes and press Enter.

You are prompted to enter a password to log in, and the password is root.

This way we log in to the module. At this time, connect the large USB storage we prepared to the USB of the module. Then enter the command to view the storage situation.

fdisk -l

 Next, we technically enter the command and use DD to copy the NVME storage pair

#挂载U盘
$ mount /dev/sda1 /mnt
#DD对拷
$ dd if=/dev/nvme0n1p1 of=/mnt/system.img.raw

 Then continue to enter the following command at the original position

$ sync
$ umount /mnt

 When we're done, we back up the currently running storage. Insert the backup USB storage into your host computer, and you can see the backup files.

         You can copy this file that is as big as NVME storage to your host computer. If there is not enough space, you can continue to put it in USB storage. Next, we will make a compressed img file of this file. Remember, store this file Plug the storage into your host.

Find the directory where the backup files are stored on your host:

 You can enter to have a look

 Next we can make a compressed IMG file.

#进入你的烧写工作目录,注意你自己的目录
cd ~/O100/O100_JetPack_5.1.1_Linux_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra
#执行压缩命令
./bootloader/mksparse --fillpattern=0 /media/nvidia/be2deb0f-3381-45c3-a1bc-32bf2139e5ef/system.img.raw system.img

 Just wait for the image to be created.

 finished

3. Burn the backup system to the new NVME storage

Put an empty NVME storage, just swapped on to your system. Note that the new NVME storage size must be greater than or equal to the previous backup storage size

Install the new NVME onto the module. Then the development kit is programmed and connected to the USB cable, and then the module recovery mode starts.

At this point your host is still the old rules, first make sure the Orin module is connected to your host.

lsusb

 At this point, you need to burn the empty system first, and you can directly execute the command to prepare the environment. This step is to make sure that the boot section in front of your nvme0n1p1 storage is all ready.

#进入你的烧写工作目录,注意你自己的目录
cd ~/O100/O100_JetPack_5.1.1_Linux_JETSON_ORIN_NANO_TARGETS/Linux_for_Tegra
#全部生成烧写
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_t234_qspi.xml" \
  --showlogs --network usb0 jetson-orin-nano-devkit internal

 Ready to mirror.

 After the execution, the official script actually created the system to the following directory.

cd {your path}/Linux_for_Tegra/tools/kernel_flash/images/external

 When actually performing programming, the files in this directory are ultimately programmed.

Overwrite the img file with the backup compressed file.

#先删除
sudo rm -f tools/kernel_flash/images/external/system.img
#拷贝之前备份的
sudo cp -f system.img tools/kernel_flash/images/external/

         At this time, it is necessary to complete the Ubuntu setup with the programmed empty system module. Otherwise, there will be insufficient space for subsequent recovery backups, because the empty system does not initialize and only has a 64G image.

        After starting up, enter the stage of "Step 1. Ubuntu setup (oem-config)" in the above picture, and perform the following 9 steps of system configuration:

1. Agree to authorization: Click the box to the left of "I accept the terms of thses licences" in the lower left corner, and then click the "Continue" button in the lower right corner to proceed to the next step;

2. Select the "Language" type: It is recommended not to select Chinese at this stage, and directly click the "Continue" button in the lower right corner to proceed to the next step;

3. Select "Keyboard Layout": directly click the "Continue" button in the lower right corner to proceed to the next step;

4. Connect to WIFI wireless hotspot: You can choose a hotspot according to your actual situation, or do not connect now, and then connect after entering the system later, and then click "Continue" in the lower right corner to proceed to the next step;

5. Select "Region": Click the area of ​​"China" in the picture with the mouse, the area below will be updated to "Shanghai", and then click "Continue" in the lower right corner to proceed to the next step;

6. Configure the user name and password: This step is the most important part, because there is no preset value, so you need to configure the user name (Your Name), device name (Your computer's name), and password (Choose a password) by yourself Input, and then click "Continue" in the lower right corner to proceed to the next step;

7. Configure the disk space used: the default is the maximum available space, it is recommended not to modify it, and then click "Continue" in the lower right corner to proceed to the next step;

8. Whether to install the Chromium browser: accept the default value (installation), and then click "Continue" in the lower right corner to proceed to the next step;

 Next, the system will execute "System configuration" according to the previous selection, as shown in the following two pictures.

         After the system configuration is completed, it will automatically restart, and then enter the Ubuntu 20.04 L4T (Linux for Tegra) desktop operating system, just like the steps that need to be performed when logging in for the first time in all Ubuntu operating systems, just select "Next". Then you will see the familiar Ubuntu standard desktop below.

 Then the development kit is programmed and connected to the USB cable, and then the module recovery mode starts.

At this point, we start to burn our backup. At this point your host is still the old rules, first make sure the Orin module is connected to your host.

lsusb

 Then start to burn the replaced system

#只更新 APP,似乎有用 flash APP partition in the NVMe:
sudo ./tools/kernel_flash/l4t_initrd_flash.sh --flash-only --external-only \
    --network usb0 -k APP --external-device nvme0n1 \
    -c tools/kernel_flash/flash_l4t_external.xml jetson-orin-nano-devkit internal

After programming, the system starts normally.

 The carrier board system has become larger, and the previously installed ROS and the like are all there.

4. Local tyrant version plan

I feel that the above method is very cumbersome, so we also provide a local method, which is simpler. You can find NVME storage pair copy machine on Taobao, which can help you complete the master disk copy.

 This is relatively cheap, and for some companies to do it in batches, one-to-many copying can be considered.

Guess you like

Origin blog.csdn.net/cau_weiyuhu/article/details/131030975