How to make a Jetson NX sd card img like official release

Dear All:
I want to make a sd card img like official Jetson NX release.
Below is my backup step:

  1. Download official release NX img and flash it on my sd card (128G).
  2. Made my work environment.
  3. Resize partition to used storage by gparded. (From 128G to 20G)
  4. Made a new img by dd command.

Below is my recover step:

  1. Format sd card and flash it by official release NX img
  2. Use dd command to replace my work partition
  3. Resize to original sd card size by gparded. (From 20G to 128G)

Current I used steps are so complicated, I want to make a img like official release just only flash it.
Can someone help me?

There are differences between SD card models and eMMC models, but roughly speaking, if your image is copied to:
…and then you flash on command line, using the “-r” option to reuse the image without generating a new image, then this gets flashed. Depending on your model, the other options as to flash target may change, but this is all using the “” command.

One issue is that if the image is not the default size, then you may need to use the “-S <size>” option. MiB is “1024*1024”, and GiB is “1024*1024*1024”. If your image is 30064771072 bytes, then this is equal to “28*1024*1024*1024”, and so you could start with:
sudo ./ -S 28GiB ...

There is no reason you couldn’t dd copy a partition after gparted or other apps have resized the partition. Just make sure the resized image is exactly a size multiple of 1024 twice or three times.