# Changes to the /data partition via an OTA update?

**URL:** <https://hub.mender.io/t/changes-to-the-data-partition-via-an-ota-update/982>\
**Category:** General Discussions\
**Created:** [September 4, 2019, 9:54am UTC](https://hub.mender.io/t/changes-to-the-data-partition-via-an-ota-update/982 "2019-09-04T09:54:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![platisd](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@platisd](https://hub.mender.io/u/platisd)\
**Post date:** [September 4, 2019, 9:54am UTC](https://hub.mender.io/t/changes-to-the-data-partition-via-an-ota-update/982/1 "2019-09-04T09:54:57Z")

</div>

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”. 😆

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.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [September 4, 2019, 10:12am UTC](https://hub.mender.io/t/changes-to-the-data-partition-via-an-ota-update/982/2 "2019-09-04T10:12:59Z")

</div>

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](https://docs.mender.io/2.0/artifacts/state-scripts) and [this example](https://docs.mender.io/2.0/artifacts/state-scripts#application-data-migration) 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.

---

<div class="post-metadata">

**Author:** ![platisd](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@platisd](https://hub.mender.io/u/platisd)\
**Post date:** [September 4, 2019, 10:25am UTC](https://hub.mender.io/t/changes-to-the-data-partition-via-an-ota-update/982/3 "2019-09-04T10:25:53Z")

</div>

Cool, I’ll have a look. Thanks a lot! 👍

---

<div class="post-metadata">

**Author:** ![platisd](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@platisd](https://hub.mender.io/u/platisd)\
**Post date:** [September 4, 2019, 11:47am UTC](https://hub.mender.io/t/changes-to-the-data-partition-via-an-ota-update/982/4 "2019-09-04T11:47:24Z")

</div>

> Note that state scripts are a feature of managed mode. State scripts are not executed when running Mender in [standalone mode](https://docs.mender.io/1.7/architecture/overview#modes-of-operation)).

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

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [September 4, 2019, 12:45pm UTC](https://hub.mender.io/t/changes-to-the-data-partition-via-an-ota-update/982/5 "2019-09-04T12:45:39Z")

</div>

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](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)

---

<div class="post-metadata">

**Author:** ![platisd](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@platisd](https://hub.mender.io/u/platisd)\
**Post date:** [September 4, 2019, 12:57pm UTC](https://hub.mender.io/t/changes-to-the-data-partition-via-an-ota-update/982/6 "2019-09-04T12:57:40Z")

</div>

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