# Root filesystem update - keep data from old partition

**URL:** <https://hub.mender.io/t/root-filesystem-update-keep-data-from-old-partition/6473>\
**Category:** General Discussions\
**Tags:** ota, system-update, rootfs\
**Created:** [January 15, 2024, 12:52pm UTC](https://hub.mender.io/t/root-filesystem-update-keep-data-from-old-partition/6473 "2024-01-15T12:52:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sd-ricardo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sd-ricardo/32/1910_2.png) [@sd-ricardo](https://hub.mender.io/u/sd-ricardo)\
**Post date:** [January 15, 2024, 12:52pm UTC](https://hub.mender.io/t/root-filesystem-update-keep-data-from-old-partition/6473/1 "2024-01-15T12:52:39Z")

</div>

Hi!! Does enaybody know if there is any way to backup a file from the old rootfs when preforming a system update?  
Let’s say I want to keep a log file and keep appending data to it once the update is completed and the system has boot from the new partition.

Apreciate any help or idea as workaroung.

Seba.-

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [January 15, 2024, 2:42pm UTC](https://hub.mender.io/t/root-filesystem-update-keep-data-from-old-partition/6473/2 "2024-01-15T14:42:01Z")

</div>

Hi @sd-ricardo,

This can be done via [state scripts](https://docs.mender.io/artifact-creation/state-scripts), you can essentially ship arbitrary pre- and post-installation logic along your artefact.

Greets,  
Josef

---

<div class="post-metadata">

**Author:** ![sd-ricardo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sd-ricardo/32/1910_2.png) [@sd-ricardo](https://hub.mender.io/u/sd-ricardo)\
**Post date:** [January 15, 2024, 4:03pm UTC](https://hub.mender.io/t/root-filesystem-update-keep-data-from-old-partition/6473/4 "2024-01-15T16:03:58Z")

</div>

So, if I have log.txt and the current boot partiion is p1 (And the next would be p2, since we are mounting p3 on /data)  
where should I back up that file?  
if booting from p1 it goes to p2 and viceversa?

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [January 15, 2024, 4:07pm UTC](https://hub.mender.io/t/root-filesystem-update-keep-data-from-old-partition/6473/5 "2024-01-15T16:07:35Z")

</div>

@sd-ricardo the only persistent thing is `/data` - unless you added more persistent partitions manually. So there it needs to go.

Greets,  
Josef
