Keep user-data when installing Easy Installer image

What we would like to be able to do is create a tezi image that keeps certain user-data (configuration files, calibration data etc) intact if it is present. If this data is not present, a set of default files should be installed. We have come up with two ways of doing this:

  1. Use the prepare and wrapup scripts to mount the existing image, copy the user-data to a temporary location (In /var/volatile, for example) and then copy this data back after the image has been installed
  2. Create 2 images: one for an initial install (e.g. during production) that includes a separate partition where the set of default files are placed, and a second image for all subsequent upgrades that does not include this partition.

I was wondering, however, if Easy Installer has some standard feature to facilitate this. I’m not seeing it in the documentation so far, but maybe it does exist after all.

Thanks in advance,


Hi Jeroen

During the flashing process with Toradex Easy Installer the partition table is remade, so you will lose all user data. You can do the first option by moving the user-data to a temporary place and copying back or you can copy this data to the tezi image and then flash the tezi image.

Hi Jaski,

Thanks for your reply. What do you mean when you say “copy the data to the tezi image”? Is this something I can do from the prepare script? How do I indicate this in the tezi json configuration file?



The Toradex Easy Installer (Tezi) as such was not meant as an update tool. It was more designed for the initial flashing/and complete recovery use case. Therefor it is rather heedless when it creates partitions: By default, after it creates the partition table, it dd’s the first kilobytes to make sure that subsequent mkfs commands succeed. Hence at its current state it is not possible to let Tezi preserve partitions.

By coping data back to the Tezi image Jaski meant reintegrating the data into a Tezi image. This would only be possible for static user data files really…

So when dealing with device dependent user data/calibration files, your best bet is option 1.

Hi Stefan,

Thanks for the explanation, that makes sense. I agree option 1 is our best bet then. I already have this working, but just wanted to make sure there is no better option.



Unfortunately no, at the moment not. Thanks for your feedback!

For option 1 here is my working script:

in you could do something like this

mkdir $SRC
mount -t auto -v /dev/mmcblk0p2 $SRC

if [ -d ${SRC}/usr/share/myapp/cfg ] 
	echo "Existing Configuration detected"
	mkdir $TGT
	cp -f ${SRC}/etc/hostname $TGT
	cp -fr ${SRC}/usr/share/myapp/cfg $TGT
	echo "Deploying to new Hardware"

umount /dev/mmcblk0p2 -l

Don’t forget to umount the partition, otherwise TEZI will show an error-message that the partitions are in use.

In the you could do something like this (IMAGE_FOLDER points to the root of my USB):

if [ -d "${BACKUP}/cfg" ] 
	cp -f ${BACKUP}/hostname ${DEST}/etc
	cp -fr ${BACKUP}/cfg $APPDIR

if [ -f "${IMAGE_FOLDER}/app.tar.gz" ]
	rm -rf dist
	tar xf ${IMAGE_FOLDER}/app.tar.gz

Hope this helps someone wanting to do similar actions.

For information - I got the name mmcblk0p2 by executing lsblk and checking the source of the / mount.

HI @tw.apex

Thanks for sharing this valuable Information.

Best regards,