Changes to the /data partition via an OTA update?

Hello Mender community,

We came across this issue today and it would be interesting to hear your thoughts about it. Let’s consider the following scenario:
After a Mender-enabled device is shipped to customers, the development team implements a new feature that requires a new path to exist in /data.
When the customer OTA updates their device (using a .mender package behind the scenes) they don’t get their /data partition changed as .mender files do not contain a /data partition. This results in unexpected behavior and developers get sad because “it worked on their bench”. :laughing:

Is there a Menderic (a la pythonic) way to do this? The solution we’ve come up thus far involve an one-time script that “fixes” the /data partition (e.g. by creating the missing paths/files) but we’d rather avoid this if we can.

Hi @platisd,

Is there a Menderic (a la pythonic ) way to do this? The solution we’ve come up thus far involve an one-time script that “fixes” the /data partition (e.g. by creating the missing paths/files) but we’d rather avoid this if we can.

The “Menderic” way of doing this would be utilizing a state-script and this example probably portraits what you are trying to do.

By using this you are actually not including anything “special” in your software as the script is provided by the Mender Artifact when you perform the update.

But in the end it is a script that runs that “migrates data” (creates paths that do not exist in your case), and I do not believe that there is a way around this if you want to keep a partition that is for persistent data not to be modified by updates.

1 Like

Cool, I’ll have a look. Thanks a lot! :+1:

Note that state scripts are a feature of managed mode. State scripts are not executed when running Mender in standalone mode).

Unfortunately, the issue in our case is that we are running Mender in standalone mode. Any suggestions that would work under these circumstances?

Mender client 2.0 and newer does execute some of the state-scripts as well,

https://docs.mender.io/2.0/artifacts/state-scripts#standalone-mode

But if you are not using a recent version then you need to go path of providing a “one time script” that is part of your software. (which you already had)

Then perhaps this is a good reason to upgrade to the latest Mender, thanks again!

1 Like