Burn .img file to flash

I am using a Colibri iMX6 board, and I would like to keep an image of the whole OS, for back-up purposes.

I got an image of the flash memory in a USB stick, using the dd command. How can I reflash the board with this image?

Can this be done through UBoot? Or should I boot from a USB stick and then dd again the image back?

How did you go about dd’ing the flash? Did you do this from the running/mounted OS/rootfs on the eMMC?

We don’t generally recommend this approach for making a production Linux image. We provide support for building Linux images using an OpenEmbedded-core/Yocto Project build system.

However, if you would still like to image the flash on a module, I’d recommend booting an image from another media (e.g. SD card, USB stick, Network) such that the rootfs isn’t mounted while you dd it. You can then dd back to the flash in a similar manner (while booted from external media).

This can also be done from U-boot; however, because two separately issued commands are needed to first write from flash to memory and then to write from memory to external media (or vice versa), it must be done piece-wise since the flash is larger than the available memory.

Easier yet would be using U-Boot’s UMS feature e.g. as explained here.

Its not working for me. I only see mounted one partition named boot with a size of app. 15mb, and not the whole mmc.

Where I can find more information and images about booting from SD or USB Flash drive? Although I searched, documentation is not clear regarding this boot option.


Note that the rootfs partition is uses an ext3 filesystem which will only be mounted if your host PC is able to use ext3. (e.g. any Linux will do, Microsoft Windows will not).

It is true that the above behavior is observed in Windows. In Linux I am not able to mount any of the partitions. No auto-mount occurs (Fedora 23 with Gnome), and I do not see any new device in /dev/ so as to mount it myself. Any info on this?

We don’t document how to do this anywhere. In short - you’d create a small (~16-32MB) FAT32 partition and a larger (>1GB) ext3 partition on the SD card or USB stick. Make sure the FAT32 partition is the first primary partition and the ext3 partition is the second primary partition. Then you’d put the kernel & device trees on the FAT32 partition and the rootfs on the ext3 partition. In Linux, you can extract the rootfs directly from a Toradex Linux image tarball directly to the ext3 partition like so (adjust the first two paths accordingly):

sudo tar -C /media/sdcard/ROOTFS/ -xvf ~/Downloads/Colibri_iMX6_LinuxImageV2.6Beta1_20160331.tar.bz2 Colibri_iMX6_LinuxImageV2.6/rootfs --strip-components=2

Then at boot up, enter the bootloader console and enter run sdboot or run usbboot.

However, as Marcel pointed out, the U-boot UMS approach is likely simpler.

On our Gnome Fedora 23 system the partitions are automonted. They are represented by /dev/sdX1 and /dev/sdX2.