Backup and recovery of jetson nano system

Keywords: sudo Ubuntu

After the system is installed, it needs to be backed up. How to restore it to other SD cards? The environment is Ubuntu 18.04, jetson system U disk, which is inserted in the form of U disk.

I. backup

1. First use the following command to confirm the device number of the u disk to be backed up

sudo fdisk -l

I'm sure it's / dev/sdc

2. Establish backup directory:

mkdir jetson_nano_data && cd jetson_nano_data

3. Backup information

sudo fdisk -l /dev/sdc > fdisk_info.txt
sudo parted -s /dev/sdc print > parted_info.txt

4. Backup 12 partitions and partition tables

sudo dd if=/dev/sdc2  of=./sdc02_TBC.img
sudo dd if=/dev/sdc3  of=./sdc03_RP1.img
sudo dd if=/dev/sdc4  of=./sdc04_EBT.img
sudo dd if=/dev/sdc5  of=./sdc05_WB0.img
sudo dd if=/dev/sdc6  of=./sdc06_BPF.img
sudo dd if=/dev/sdc7  of=./sdc07_TOS.img
sudo dd if=/dev/sdc8  of=./sdc08_EKS.img
sudo dd if=/dev/sdc9  of=./sdc09_LNX.img
sudo dd if=/dev/sdc10 of=./sdc010_DTB.img
sudo dd if=/dev/sdc11 of=./sdc011_RP4.img
sudo dd if=/dev/sdc12 of=./sdc012_BMP.img
sudo dd if=/dev/sdc1  of=./sdc01_APP_16M.img bs=1M count=16

sudo dd if=/dev/sdc  of=./sdc_32M.img bs=1M count=32

5. The first partition to mount the backup (the partition where the system data is located):

sudo mkdir -p /media/fzyzm/linux_sys
sudo mount -t ext4 /dev/sdc1 /media/fzyzm/linux_sys

6. Backup system data

sudo dump -0uj -f ./dump_backup_20190701.dump.bz2 /media/fzyzm/linux_sys/

II. Recovery (use root user in the whole process)

1. First use the following command to confirm the device number of the u disk to be recovered

sudo fdisk -l

I'm sure it's / dev/sdc

2. View the partition and delete the existing partition:

parted -s /dev/sdc print
parted -s /dev/sdc rm 1
parted -s /dev/sdc rm 2
parted -s /dev/sdc rm 3
parted -s /dev/sdc rm 4
parted -s /dev/sdc rm 5
parted -s /dev/sdc rm 6
parted -s /dev/sdc rm 7
parted -s /dev/sdc rm 8
parted -s /dev/sdc rm 9
parted -s /dev/sdc rm 10
parted -s /dev/sdc rm 11
parted -s /dev/sdc rm 12

3. Create a partition:

parted /dev/sdc --script -- mklabel GPT
parted --script /dev/sdc mkpart APP ext4 24576s 100%
parted --script /dev/sdc mkpart TBC 2048s 2303s
parted --script /dev/sdc mkpart RP1 4096s 4991s
parted --script /dev/sdc mkpart EBT 6144s 7295s
parted --script /dev/sdc mkpart WB0 8192s 8319s
parted --script /dev/sdc mkpart BPF 10240s 10623s
parted --script /dev/sdc mkpart TOS 12288s 13439s
parted --script /dev/sdc mkpart EKS 14336s 14463s
parted --script /dev/sdc mkpart LNX 16384s 17663s
parted --script /dev/sdc mkpart DTB 18432s 19327s
parted --script /dev/sdc mkpart RP4 20480s 20735s
parted --script /dev/sdc mkpart BMP 22528s 22687s

3. Restore the remaining 11 partitions:

dd of=/dev/sdc2  if=./sdc02_TBC.img
dd of=/dev/sdc3  if=./sdc03_RP1.img
dd of=/dev/sdc4  if=./sdc04_EBT.img
dd of=/dev/sdc5  if=./sdc05_WB0.img
dd of=/dev/sdc6  if=./sdc06_BPF.img
dd of=/dev/sdc7  if=./sdc07_TOS.img
dd of=/dev/sdc8  if=./sdc08_EKS.img
dd of=/dev/sdc9  if=./sdc09_LNX.img
dd of=/dev/sdc10 if=./sdc010_DTB.img
dd of=/dev/sdc11 if=./sdc011_RP4.img
dd of=/dev/sdc12 if=./sdc012_BMP.img

4. Format system data partition and mount it

mkfs.ext4 /dev/sdc1
sudo mkdir -p /media/fzyzm/linux_sys
sudo mount -t ext4 /dev/sdc1 /media/fzyzm/linux_sys

5. Recovery system:

cd /media/fzyzm/linux_sys
restore -r -f /media/fzyzm/S_LINUX_OTHER/jetson_nano_data/dump_backup_20190701.dump.bz2

Note: if you want to restore to an existing system disk, you can start from step 4

Posted by Chief on Thu, 31 Oct 2019 12:12:20 -0700