How to backup Verdin imx8mp on Dahlia board

I need to backup the current image flashed to my SOM before I install a new image. Is there an easy way to create a backup that can be flashed back at a later date?

Thanks!

root@verdin-imx8mp-15007245:/# tdx-info

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.77-6.2.0-devel+git.5ee7b429cf75 #1 SMP PREEMPT Fri Feb 17 12:53:14 UTC 2023
Kernel command line:      root=PARTUUID=f4cb4122-02 ro rootwait console=tty1 console=ttymxc2,115200 consoleblank=0 earlycon
Distro name:              NAME="TDX Wayland with XWayland"
Distro version:           VERSION_ID=6.2.0-devel-20230615203936-build.0
Hostname:                 verdin-imx8mp-15007245
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Verdin iMX8M Plus WB on Dahlia Board
Toradex version:          0058 V1.1A
Serial number:            15007245
Processor arch:           aarch64
------------------------------------------------------------

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

To create a backup of the current image flashed on your Verdin iMX8M Plus module, you can use the dd command to create an image of the eMMC storage. This process requires you to boot from an external source, such as an SD card or a USB drive, with a Linux distribution that supports the eMMC hardware on your module. This is because you cannot create a reliable backup of a live filesystem that is currently in use.

Here are the general steps to create a backup:

  1. Boot your system from an external source that does not use the eMMC storage you wish to backup.
  2. Identify the eMMC device. It is typically listed as /dev/mmcblkX, where X is a number. You can use the lsblk command to help identify it.
  3. Use the dd command to create an image of the eMMC storage. Replace /dev/mmcblkX with the correct device identifier for your eMMC storage.
sudo dd if=/dev/mmcblkX of=/path/to/backup/image_name.img bs=4M status=progress
  1. Once the dd command completes, you will have an image file that you can use to restore your system at a later date.

To restore the image:

  1. Boot from an external source as you did for the backup process.
  2. Use the dd command to write the image back to the eMMC storage. Be very careful to specify the correct device for the eMMC storage, as this process will overwrite all data on the target device.
sudo dd if=/path/to/backup/image_name.img of=/dev/mmcblkX bs=4M status=progress

Please ensure you have sufficient storage space on the external source for the backup image and verify the eMMC device identifier (/dev/mmcblkX) carefully to avoid data loss.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

QNX | Toradex Developer Center.

Do you have instructions on creating a bootable USB device and then how to boot from this device?

Also, I have a few devices with names similar to mmcblkx. Which one do I backup?

brw-rw----  1 root disk    179,   0 Jun  2 12:48 mmcblk2
brw-rw----  1 root disk    179,  32 Jun  2 12:48 mmcblk2boot0
brw-rw----  1 root disk    179,  64 Jun  2 12:48 mmcblk2boot1
brw-rw----  1 root disk    179,   1 Jun  2 12:48 mmcblk2p1
brw-rw----  1 root disk    179,   2 Jun  2 12:48 mmcblk2p2
crw-------  1 root root    234,   0 Jun  2 12:48 mmcblk2rpmb

Hi @david.bouthillier

I’m not sure backing up the block device while it is mounted will necessarily be a stable approach to this. Depending on what specifically you have added to your system, it may be tricky to guarantee that nothing is changed while you are writing the backup. That said, you can use the mount and lsblk command to get info about the filesystems that are mounted.

I’m not sure this is the right approach though. Whether you use Torizon or a highly customized Yocto image, most likely the best approach would be to identify what specific data files are appropriate to back up and only save those. Then when needing to restore, you install a fresh image and restore just the data files. Of course this requires a lot more thought about what files are stored where and such but probably is a more scalable and robust solution.

If you use Torizon, most likely all relevant changes are in either the /etc or /var directories as the rest of the system is effectively read-only. And you can likely narrow it down even further as a lot of that data is either unmodified from the initial install or ephemeral and reconstructed each boot.

If you use a custom Yocto, it’s harder to say with certain due to the flexibility of that approach and you can store custom data anywhere.

If you can clarify your use case, what data is important, and why you want to back up and restore, I can likely provide you more concrete advice.

Drew