How to back up current state of system sd card image?


Can anyone suggest the best way for me to backup the current state of the system from my Nano’s (128GB) SD Card?

I’d like to clone the card completely so that if I break something I can restore the system to it’s current state by re-flashing the backup using balenaEtcher (instead of using the default NVidia image).

I’ve tried Win32DiskImager in Windows 10 with the SD card in a reader, but although it read an image I’m not convinced it’s correct as there are 12 partitions on the SD card and windows maps a separate drive to each (and annoyingly brings up 12 windows each with a formatting error) when I plug in the reader and judging by the size if the image it created it only read some of the sd card.

I have a Ubuntu dual-boot on my host PC too, so maybe there’s a way I can do it from that? I’ve seen some docs on doing something similar for Rasp. Pi via ssh using dd command, but I couldn’t get the this to work as I’m fairly new to Linux.

Can anyone point me at a technique that will work?


If you have 128GB of free space, then under Linux you can use dd. Basically find out what the device name is…monitor “dmesg --follow”, and then connect the SD card to the host. If it asks about mounting do not mount. Let’s say it turns out the device shows as “/dev/mmcblk1”, then this will create an exact image of the entire SD card in a single file:

sudo dd if=/dev/mmcblk1 of=clone_image.bin bs=512

(arbitrary name “clone_image.bin” because unless it is a single partition, then it is binary data; block size 512 is arbitrary and could be increased in powers of two for faster copy/write…512 is just traditional as the smallest block size on most disks)

To place that image on a matching SD card, assuming it is “/dev/mmcblk2”:

sudo dd if=clone_image.bin of=/dev/mmcblk2 bs=512

It would be quite slow, but direct SD-to-SD clone:

sudo dd if=/dev/mmcblk1 of=/dev/mmcblk2 bs=512

There are ways to extract the individual rootfs from a full image, so you might want to save information on the partition layout at the time of clone:

sudo gdisk -l /dev/mmcblk1 2>&1 | tee table_for_clone.txt
sudo lsblk -f /dev/mmcblk1 2>&1 | tee <b>-a</b> table_for_clone.txt

Perfect. Many thanks.

Instead of dd, gnome-disks works and has less of a risk of accidentally overwriting something important. Just hit the windows key in Ubuntu and type Disks and the Disks app will be your first result. The backup and restore image options are under the hamburger menu in the top right.

It’s normal for there to be many partitions.

If you want to deploy custom images, and not just make a backup to the same exact machine, you will need to make a custom image with JetPack.

1 Like

For myself I use KDE on Fedora, so no such tool, but “dd” is universal. On the other hand, I don’t know of any risk to using dd other than naming the wrong output location (obviously a GUI tool with something to click on would be less likely to make that mistake).


Dd may be universal, but /dev/sda is not. Sometimes it’s the first sata drive. Sometimes it’s the first USB drive. You see where I’m going. A gui tool shows you all the details, size, etc. Instead of /dev/sombodythoughtthiswasagoodidaa184937 you click on “64 gb SD card”. Personally I feel that’s harder to screw up on. It also doesn’t require your user to have sudo.

I agree…I have actually done that long ago but was fortunate enough that it didn’t hit anything important. Knowing which drive is which is something many people will need to be careful with and may not realize the degree of care required. These days I just try to verify first via plugin/unplug and “dmesg --follow”. Maybe “lsblk -f” to cross verify.

Haha. So have I. Its easier than it should be to do, which is why I use frontend tools for dd (like what gnome-disks probably is). There is likely something for kde as well knowing how bloated it is ;)

Edit: to be fair, I haven’t used KDE since version 2, so it may be better now.

Hey Everyone,

Had a follow up question. I want to be able to deploy to multiple Nanos, an updated version of the Nvidia Nano Image.

Meaning, I go in to a fresh install of the Nvidia Nano Image and let’s say, I set up Wi-Fi and copy some files in.
I’d like to make an image out of that and I was planning to go with the dd solution.
However, I want to be able to use this image on multiple Nano Boards.

I’m guessing because of hardware specific settings within the OS, it’s not the best idea to deploy the exact same image to multiple machines? Please correct me if I’m wrong.

I’ve used CloneDeploy for a Windows and Ubuntu PC environment before, however, I don’t think there is an accessible BIOS for me to get into the Nano and create an image and deploy an image using USB or PXE boot.

Any advice is much appreciated! :)

As soon as a first boot happens, changes are made that are unique to the system (ssh host keys are generated, for instance). Your machines would boot but you would have a lot of problems the least of which would be related to network connectivity.

Nvidia provides tools to customize the rootfs / kernel / etc, so you can make your own image just like Nvidia’s that does all the proper stuff on first boot. That’s what I would recommend using.

You shouldn’t have to recompile anything or rebuild anything. Just download/install Sdk manager, edit the rootfs in it’s install folder to install the files you want to add, and run a few scripts to write your changes to an image you can flash on a microsd card. Can I ask the broad strokes of what you want to add to / change in the image?

In addition to ssh keys which @mdegans mentioned, passwords and files associated with passwords (shadow files) also get copied. You might want to give a better idea on details of how each copy is used. However, in the end, it is usually multiple trial and error tests to verify if things are being done as desired.

This is good advice. Rarely do things go perfectly the first time. You might also research whether there are tools to do this. I know for certain there are for vm.

I’ve been googling for a while to find something to pack up a working system to a rootfs tarball after cleaning it up but I can’t find any. I don’t know if it exists. I think most people customize their rootfs with qemu.

Edit: see virt-sysprep below which might help.

example rootfs use with busybox:

If you wish, here is an alternative:

So, assuming you’ve installed JetPack with the sdk manager, if you look in the Linux_for_Tegra folder in the install path you’ll see this.

$ ls*                    p2371-2180.conf
bootloader/                           p2371-2180-devkit-24x7.conf*  p2371-2180-devkit.conf*                     p3448-0000.conf*                             p3448-0000.conf.common
jetson-nano-qspi.conf@                p3448-0000-sd.conf
jetson-nano-qspi-sd.conf@             rootfs/
jetson-tx1.conf@                      sources/
kernel/                     *
lib/                                  tester.img
nv_tegra/                             TX1_boot-firmware-redundancy.txt

interesting to you are the rootfs folder and

You’ll then need to cd into rootfs/etc. Once there, run:

wpa_passphrase YOURNETWORKNAME | sudo tee wpa_supplicant.conf

Type in your WIFI password, hit enter, type your sudo password, hit enter. That will store your wifi
configuration so that it should just work when you plug in a wifi interface.


cat wpa_supplicant.conf

And run over the details to confirm they were stored, and your password is correct. If you wish you can edit out the commented plain text password with your editor of choice.

Any other files can be simply copied into the rootfs folder. Then from the Linux_for_Tegra folder, run:

sudo -o some-image-filename.img -s 8G -r 200

This will require a minimum 8G card to flash, but will expand to the extents of any size card on first boot, If you add more than 8G, you will need to increase the number.

hostname can be customized in rootfs/etc/hostname

network configuration is in rootfs/etc/network

users will be created on first boot.

ssh keys will be generated on first boot.

additional users (like system users for services) can be added, but you’ll need to use qemu.

apt packages can be added, but you’ll need to use qemu as well I think.

I found another tool that might be useful if you’re still interested in the cloning route:

Is it possible to do this straight from the Nano? I have a 64GB SD Card, and I plan to copy everything into a 128GB SD Card. I have a USB Card reader that I can plug into the Nano. What do I run?

1 Like

This will only work if the filesystem is mounted read-only. See this, look closely at the sysrq:

This is a different way to do the sysrq:


I am trying to clone from 64GB sdcard to 16GB sdcard. I tried to use the dd command, but seems it will only generate 64 GB .img file which cannot be flashed to 16G sdcard.

Also before I flashed it, I already shrink the partitions. Right now it is like 10 GB used, while 54GB are unallocated. I also tried to follow [url][/url] But after the truncate, the .img file is broken and fail to boot.

Duplicate, see:

In sports someone might say “it’s all in the wrist”. With dd, you might say “it’s all in the device name”. Name the device as a whole, and you get the device as a whole. Name a partition, and you get a partition.

My VM does not currently recognize devices. Any way I can clone the image using Windows?

Etcher can clone SD cards, but I’ve never used it so I can’t say anything about exact procedure. You’d need to clone the SD card as a whole, and not individual partitions since there are boot-related partitions other than the rootfs.