Cant write backup image to TX1

Hi everyone,

I have the following problem:
I clone the system.img of the Tegra X1 every week. Then I wanted to install the latest tools with JetPack 2.3, which didn’t work. Some Libs were misssing to install Cuda 8. (cuda-toolkit-8-0 libgompl libfreeimage-dev libopenmpi-dev open-bin ).

So I decided to flash the whole Tegra with Ubunu 16.04, and so far, all worked fine - full installation of CUDA, Vision Works, Open CV. But with this JetPack, the system.img files have a size of 15.0 GB (15.032.385.536 Bytes). The tegra has additional partitions with about 300 MB. My old backups, before JetPack 2.3, have all the size of 15.3 GB (15.288.238.080 Bytes).

So I can’t write my old backups to the tegra, since the size of the target is too small.
What can I do now? I want my old system with 15.3 GB on the Tegra.

Best
Manu

The image will always have to be an exact byte size which is a multiple of 1024. When flashing with “-S 14GiB”, the image will be exactly “14102410241024" bytes. If using “-S 14580MiB”, the image must be exactly "145801024*1024” bytes (this matches the byte size you gave, so the cloned image you call 15.3GB was produced with flash using “-S 14580MiB”). Actually restoring your clone might defeat the purpose of having upgraded to get more dependencies…restoring a clone will erase your package updates.

The other partitions are hidden, and needed. I do not know if they vary in size across different L4T release versions, but if they do change, then so does the starting offset of the root partition. Should your root partition image fit in remaining space, then chances are the image will work. I don’t know if clone restore actually pays attention to a “-S” parameter, but you might want to copy your clone into “bootloader/system.img”, then flash (be careful to use “-r” so as to not overwrite your image):

<s>sudo ./flash.sh -r -S 14580MiB mmcblk0p1 jetson-tx1</s>
sudo ./flash.sh -r -S 14580MiB jetson-tx1 mmcblk0p1

Keep in mind that if you want to you can also loopback mount the image, then copy it into the same location sample rootfs would have gone (e.g., “sudo mount -o loop ./clone.img /mnt”, then use “sudo cp -adpR” or rsync to put a copy of this into “Linux_for_Tegra/rootfs/”). Should you do this, everything except for the boot files would match that cloned image. Since you don’t want to flash, this is only a backup plan.

Also note that on your host you can use something like gparted to resize the clone image if you first cover the image with loopback, and then run gparted on the loopback device special file. You would need to resize such that it follows the exact byte size rules listed above for multiples of 1024. In a similar manner you could also create an empty file of the exact desired size, then format it as ext4 under loopback, and recursively copy or rsync from the original cloned image onto that new loopback covered file to use this as a restore image.

Thanks for your answer. First, I received the message “Invalid target board”. After checking https://devtalk.nvidia.com/default/topic/764634/jetson-tk1-flashing/ ,

I made

sudo ./apply_binaries.sh

before, then sudo ./flash.sh -r -S 14580MiB mmcblk0p1 jetson-tx1
which also ended in “Inavlid target board”. After checking the Quick Start Guide http://developer.download.nvidia.com/embedded/L4T/r23_Release_v1.0/l4t_quick_start_guide.txt, I noticed I have to change the order of the command to

sudo ./flash.sh -r -S 14580MiB jetson-tx1 mmcblk0p1

like mentioned in one of your previous posts https://devtalk.nvidia.com/default/topic/898999/tx1-r23-1-new-flash-structure-how-to-clone-/

The host is now writing my backupfile to the TX1, which is currently in /bootloader/system.img

I succeeded with this. Thanks again!

Best
ManuKlause

Thanks, I see I switched the command line argument order in the flash.sh example; I’ve edited the original to show this corrected flash command. Just be careful to not lose your backup…if you ever run without “-r” it’ll be overwritten.

To avoid loosing my backups, their names are unique. I include the date to the filename, for example system-2016-10-26. When I want to clone a backup, I rename it to system.img