# Store content variables permanently

**URL:** https://discourse.nodered.org/t/store-content-variables-permanently/46986
**Category:** General
**Created:** [10 June 2021 12:53 UTC](https://discourse.nodered.org/t/store-content-variables-permanently/46986 "2021-06-10T12:53:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Pinky](https://avatars.discourse-cdn.com/v4/letter/p/3d9bf3/32.png) [@Pinky](https://discourse.nodered.org/u/Pinky)
#### Post date: [10 June 2021 12:53 UTC](https://discourse.nodered.org/t/store-content-variables-permanently/46986/1 "2021-06-10T12:53:23Z")

</div>

Hi everybody,

I am running node red on a raspberry pi 4 (8gb) as an instance of iobroker. That means Paths and so on are not as given in the usual installation way but different.

I noticed, that all my variables are lost after a restart, so currently I try to find a way to store them on the filesystem.  
As written [here](https://nodered.org/docs/user-guide/context) I changed the settings.js file and commented-in the storage information. As mentioned, my node red installation was made by iobroker. Due to that fact there are several settings files in different paths than usual, so I searched the whole system for settings.js and changed the mentioned lines in every single of them.

Afterwards I created change nodes and entered: change-\>set-\>flow.myVar to msg.payload

This works as long as the system is running. But after a reboot, when I try: set-\>msg.payload to flow.myVar I receive "undefined". So the values still get lost during a reboot.

Is there any other setting that may need to be adjusted?

These are the lines that I have in my settings.js:

```auto
    contextStorage: {
        default: {
            module:"localfilesystem"
        },
    },

```

```auto
pi@raspberrypi:~ $ sudo find / -name settings.js
/home/pi/.config/chromium/Default/Extensions/cjpalhdlnbpafiamejdnhcphjbkeiagm/1.35.2_0/js/settings.js
/opt/iobroker/node_modules/node-red/settings.js
/opt/iobroker/node_modules/luxon/src/settings.js
/opt/iobroker/node_modules/@node-red/runtime/lib/storage/localfilesystem/settings.js
/opt/iobroker/node_modules/@node-red/runtime/lib/api/settings.js
/opt/iobroker/node_modules/@node-red/runtime/lib/settings.js
/opt/iobroker/node_modules/@node-red/editor-api/lib/admin/settings.js
/opt/iobroker/node_modules/@node-red/editor-api/lib/editor/settings.js
/opt/iobroker/node_modules/iobroker.node-red/settings.js
/opt/iobroker/iobroker-data/node-red/settings.js

```

Every settings.js that fits the right fomat (has the storage-lines commented out in it) was edited by me

Any ideas?

Best regards,  
Pinky

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [10 June 2021 13:03 UTC](https://discourse.nodered.org/t/store-content-variables-permanently/46986/2 "2021-06-10T13:03:13Z")

</div>

And did you set the options to actually point to a location on disk ?  
[https://nodered.org/docs/api/context/store/localfilesystem#options](https://nodered.org/docs/api/context/store/localfilesystem#options)

---

<div class="post-metadata">

### Author: ![Pinky](https://avatars.discourse-cdn.com/v4/letter/p/3d9bf3/32.png) [@Pinky](https://discourse.nodered.org/u/Pinky)
#### Post date: [10 June 2021 13:16 UTC](https://discourse.nodered.org/t/store-content-variables-permanently/46986/3 "2021-06-10T13:16:35Z")

</div>

Yeah, thats it.  
Turned out, I missed the correct file.

It gets deleted and recreated with every start of the instance as it seems.  
The correct file can be found here in this guide: [Node Red Persistence Funktion einschalten](https://forum.iobroker.net/topic/17294/node-red-persistence-funktion-einschalten/2)

Thanks alot!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [24 June 2021 13:17 UTC](https://discourse.nodered.org/t/store-content-variables-permanently/46986/4 "2021-06-24T13:17:25Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
