Flash SD card

How to transfer an already installed file system from Jetson AGX xavier to SD card and then boot from SD card?

Do you have a Linux host PC with two SD card readers? Are the two SD cards the same size?

Yes, I have a host PC with two sd card slots.

You did not state if both SD cards are the same size. I will pretend that they are, but you can add details if not. I will also pretend that the source of data shows up as “/dev/sdb”, and the partition on it is “/dev/sdb1”. You might have to adjust. I will assume the recipient is “/dev/sdc”, and that you don’t mind overwriting anything on it.

First, keep devices being read or written with dd unmounted. That’s the “umount” command, and needed since usually SD cards get auto mounted. An example if mount is shown from the “lsblk -f” command:

sudo umount /dev/sdb1
sudo umount /dev/sdc1

To directly copy an entire SD card, including metadata, to become a 100% clone, including partition and volume IDs, so on:

sudo dd if=/dev/sdb of=/dev/sdc bs=100M status=progress

After this “lsblk -f” should show both are identical (other than the “/dev/sdb” versus sdc).

If the recipient is larger than the source, then some space won’t be used. This can be fixed.

If the recipient is smaller than the source, then we cannot directly clone like that, unless the partition in question is the same size. If that’s the case, then we’d clone partition-to-partition instead of entire SD-to-SD. If needed, then I can give you instructions on gdisk to set up partitions. If and only if you will need to set up partitions manually, then in addition to the “lsblk -f” output for each SD card, I’ll need to see the output of:

sudo gdisk -l /dev/sdb
sudo gdisk -l /dev/sdc

(assumes sdb and sdc…adjust for your case)

Incidentally, an easy way to make logs of this:

sudo gdisk -l /dev/sdb 2>&1 | tee log_sdb.txt
sudo gdisk -l /dev/sdc 2>&1 | tee log_sdc.txt

(remember, you don’t need this unless sizes differ such that we have to partition)

Is it possible to clone the root directory using the dd command, then mount it to the Linux_for_Tegra/rootfs directory, and use the jetson-disk-image-creator.sh script to make an image, write it to the sd card and then boot from it?