I have a Jetson TX2 board. I have come across several forums that give me an insight into backing up the jetson. but none of them gives a clear insight into what tool I must use to create a complete backup image. How do I backup the TX2 board completely as a snapshot image? Most preferably using ssh.
The question is not quite as simple as it may seem. If we were talking about a desktop PC, then the BIOS/UEFI will create a uniform boot environment, and actual disk content is rather simple. No embedded system has a BIOS/UEFI, and so there are a lot of partitions used for boot which are somewhat analogous to the content of the CMOS/BIOS/UEFI.
Unless you have modified the boot environment outside of the root filesystem (e.g., a custom bootloader), then you need only back up the root filesystem, then restore using the same flash software release version. That surrounding non-rootfs content is the part which is custom.
Earlier releases for Jetsons did not use partition signing, and thus it would have been possible to also make binary copies of those partitions and simply clone the whole thing (perhaps with some difficult procedures) back into a Jetson and have it “just work”. The irony is that an ordinary flash with just the rootfs would have done the same thing, and been much easier with fewer requirements.
Newer Jetson releases also sign the non-rootfs content. I do not know if the signed content from one Jetson would work when flashed to another, but probably at best it would be a pain. Technically, if you could just write that content to the eMMC of the same Jetson, then I think that sort of signed content would work without issue. That’s if you could get the signed content in place, and that is yet another story.
If the Jetson is up and running, then it is not difficult to replace partitions using
dd. If this is a backup, then presumably this is not possible because there has been a failure.
dd and other tools would be unreachable. Only recovery mode would be possible.
Recovery mode does not simply make a Jetson a generic bulk storage device. A recovery mode Jetson is a custom USB device understood by the flash software (the “driver package” which JetPack/SDKM is a front end for). When flashing the more recent releases boot software is signed as it is installed. If you had a signed partition, then put it in place, this would unfortunately result in signing the signed partition a second time and not work. You would have to take the content, unsign it, and then use that to flash with. The end result would be the same as if you simply flashed normally and reused your clone image, and this is much easier than manually dealing with partition signing.
Are you using custom non-rootfs boot content? What is your specific use case? There are lots of ways to back up content over ssh, especially for non-rootfs partitions, but the usefulness of that is questionable. Backing up the rootfs on a running system is possible, but there are a few reasons why a recovery mode clone is better (live backup, if done correctly, is not problematic and will work, but there would be slight differences compared to recovery mode backup).
Using the L4T tools, it is possible to create a carbon copy of Jetson TX2 by backing-up and restoring the eMMC partitions. The Jetson must be connected to a remote PC over USB and entered into recovery mode.
Cloning the Image
cd into the directory containing the L4T installation package on the host PC. The command below will save the TX2’s eMMC image to the specified file on the host.
$ sudo ./flash.sh -r -k APP -G backup.img jetson-tx2 mmcblk0p1
In this case, we call the file backup.img, so the same flash.sh script can be re-used to format and flash other Jetson’s with the image.
Note that if you receive an error from the script about unrecognized -G option, replace your flash.sh with the script from https://devtalk.nvidia.com/default/topic/1000105/jetson-tx2/tx2-cloning/post/5111893/#5111893
Copy the backup raw image to flashing directory
copy the .raw file which contains complete image from source device.
$ sudo cp backup.img.raw bootloader/system.img
Restoring the Image
The recommended way to restore multiple units with different serial numbers is to save the image above as “system.img” and use the head L4T flashing script, flash.sh, with the -r option (to reuse your backed-up system.img without rebuilding the vanilla image from scratch):
$ sudo ./flash.sh -r -k APP jetson-tx2 mmcblk0p1
I hope this information is useful to you.
You may find Jim’s backup tools of interest: https://www.jetsonhacks.com/2020/07/21/lets-backup/
He also mentions: