# How do I recover my flows from an old SD card?

**URL:** <https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410>\
**Category:** General\
**Created:** [10 January 2022 16:27 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410 "2022-01-10T16:27:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![BruceEmsworth1](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@BruceEmsworth1](https://discourse.nodered.org/u/BruceEmsworth1)\
**Post date:** [10 January 2022 16:27 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/1 "2022-01-10T16:27:53Z")

</div>

I want to recover my flows from an old SD card after it stopped booting. It is in a RPi4 and is the Bullseye version.  
I have built a new card and have the old card and the file system seems to be all(?) there.  
What files do I have to move from the old file system to the new file system to get my old flows back?  
Thanks in advance and apologies for such a basic question  
Bruce

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [10 January 2022 17:01 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/2 "2022-01-10T17:01:10Z")

</div>

Assuming the defaults

You want the content of the `/home/pi/.node-red` directory (including the hidden files that start with `.`)

You could just take the whole directory and it will pull in any extra nodes you may have installed.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 January 2022 17:23 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/3 "2022-01-10T17:23:53Z")

</div>

In case you have installed a different version of nodejs you should also go into the .node-red directory and run  
`npm rebuild`  
to rebuild any nodes that need rebuilding.

---

<div class="post-metadata">

**Author:** ![BruceEmsworth1](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@BruceEmsworth1](https://discourse.nodered.org/u/BruceEmsworth1)\
**Post date:** [10 January 2022 17:53 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/4 "2022-01-10T17:53:21Z")

</div>

Thanks both, well it NEARLY worked!

I copied the entire .node-red directory over to my new card (just in case I renamed the original .node-red-old).  
I now have my flows, but in the editor is says that 4 types of node are missing. Just FYI ui\_base, ui\_chart, ui\_gauge and ui\_led.

When I go to "Manage Palette - Install" the items are greyed out as it thinks that they are already installed.

Any suggestions? I feel I am SOOO close....  
Thanks  
Bruce

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 January 2022 18:31 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/5 "2022-01-10T18:31:27Z")

</div>

In the .node-red folder remove and reinstall the dashboard.  
`npm remove node-red-dashboard`  
`npm install node-red-dashboard`  
Then restart node red, clear the browser cache and reload the page. If it still doesn't work then post the node red startup log here.

---

<div class="post-metadata">

**Author:** ![BruceEmsworth1](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@BruceEmsworth1](https://discourse.nodered.org/u/BruceEmsworth1)\
**Post date:** [10 January 2022 18:44 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/6 "2022-01-10T18:44:01Z")

</div>

OK Tried .....  
`npm remove node-red-dashboard`  
`npm install node-red-dashboard`

and ran node-red-log with the following output ....

````auto

10 Jan 18:37:28 - [warn] Projects disabled : editorTheme.projects.enabled=false
10 Jan 18:37:28 - [warn] Flows file name not set. Generating name using hostname.
10 Jan 18:37:28 - [info] Flows file : /home/pi/.node-red/flows_RPi205.json
10 Jan 18:37:28 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
10 Jan 18:37:28 - [info] Waiting for missing types to be registered:
10 Jan 18:37:28 - [info] - ui_base
10 Jan 18:37:28 - [info] - ui_chart
10 Jan 18:37:28 - [info] - ui_gauge
10 Jan 18:37:28 - [info] - ui_led
10 Jan 18:37:28 - [info] Server now running at http://127.0.0.1:1880/
Stopping Node-RED graphical event wiring tool...
10 Jan 18:39:18 - [info] Stopping flows
10 Jan 18:39:18 - [info] Stopped flows
nodered.service: Succeeded.
Stopped Node-RED graphical event wiring tool.
nodered.service: Consumed 7.512s CPU time. ```

Thanks for you patience
Bruce
````

---

<div class="post-metadata">

**Author:** ![BruceEmsworth1](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@BruceEmsworth1](https://discourse.nodered.org/u/BruceEmsworth1)\
**Post date:** [10 January 2022 19:02 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/7 "2022-01-10T19:02:37Z")

</div>

So I managed to remove and reinstall ui\_led - from "Manage Palette" under "Nodes" it showed that ui\_led was there but allowed me to disable it and uninstall it - so I could reinstall that one.

However, the other 3 nodes are all part of the "node-red-dashboard" node. That has 21 nodes and it reports that it can't find the nodes. Worse some of the nodes like ui\_group are "In Use" and it won't let me stop them - so I don't get the option to uninstall them. If I could, then maybe I could reinstall the whole dashboard??

I am using the GUI through my Chrome browser now, but can I uninstall this from the command line? That way I can have node-red shut down and just delete the nodes....  
Thanks  
Bruce

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 January 2022 19:48 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/8 "2022-01-10T19:48:29Z")

</div>

> [@BruceEmsworth1](#):
>
> OK Tried .....  
> `npm remove node-red-dashboard`  
> `npm install node-red-dashboard`
> 
> and ran node-red-log with the following output

Did you restart node red? To do that run  
`node-red-stop`  
`node-red-start`

---

<div class="post-metadata">

**Author:** ![BruceEmsworth1](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@BruceEmsworth1](https://discourse.nodered.org/u/BruceEmsworth1)\
**Post date:** [10 January 2022 19:49 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/9 "2022-01-10T19:49:55Z")

</div>

Yes, restarted node-red and flushed the cache in the browser.  
Even tried using Firefox instead of Chrome .....

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 January 2022 21:01 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/10 "2022-01-10T21:01:39Z")

</div>

Do you have any other ui nodes installed? If so, you should uninstall them, then uninstall the dashboard stop NR, reinstall the dashboard and then the ui nodes and restart NR.

If you don’t know and can provide your flow I can look at it and let you know.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 January 2022 21:59 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/11 "2022-01-10T21:59:01Z")

</div>

Also I would really like to see the start of the log which you can get from  
`node-red-start`

---

<div class="post-metadata">

**Author:** ![BruceEmsworth1](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@BruceEmsworth1](https://discourse.nodered.org/u/BruceEmsworth1)\
**Post date:** [11 January 2022 13:42 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/12 "2022-01-11T13:42:40Z")

</div>

OK I gave up. Clearly there isn't a way to easily import flows from a "backup"!  
It begs the question of how NodeRed is deployed (and backed up for recovery) in any form of production environment ?????

Anyway, I had exported my flows a few weeks ago and had the code on my disk. So I reformatted the SD card, started NodeRed, imported the Nodes that were "missing" then re-imported my flows.

I have only lost the changes that were made recently (not a big problem for me as my dashboard is fairly static) but what happens if the changes are important???

Maybe we need to suggest an improvement to NodeRed?  
Regards  
Bruce

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [11 January 2022 14:17 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/13 "2022-01-11T14:17:50Z")

</div>

> [@BruceEmsworth1](#):
>
> OK I gave up. Clearly there isn't a way to easily import flows from a "backup"!

Dont give up .. just explain what the problem is. I was under the impression that you had your flows back when you said

> [@BruceEmsworth1](#):
>
> I now have my flows

and the only problem was some missing nodes ?

> [@BruceEmsworth1](#):
>
> what happens if the changes are important???

if you made critical changes to your flows .. simply do a more often backup of the whole `.node-red` folder (on a seperate disk)

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [11 January 2022 14:18 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/14 "2022-01-11T14:18:29Z")

</div>

I think it's import to remember that it's possible that the reason the card stopped booting may have also corrupted content of the `.node-red` directory.

This is why backups should be out of band of the original storage.

---

<div class="post-metadata">

**Author:** ![BruceEmsworth1](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@BruceEmsworth1](https://discourse.nodered.org/u/BruceEmsworth1)\
**Post date:** [11 January 2022 14:24 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/15 "2022-01-11T14:24:42Z")

</div>

Actually I am not sure that backing up the whole of the .node-red folder is the answer.

I guess what I want now is for someone who knows NodeRed really WELL (probably one of the developers) to come up with a good backup and recovery mechanism.

Going into an application and doing an "export" is not a good backup strategy. We need something that can be automated and run on a regular schedule.  
Just my 2p worth  
Bruce

PS My "giving up" was just to that approach. By rebuilding the card and importing my old backup I have only lost a few weeks changes and I did the rebuild during a Zoom call!!!

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [11 January 2022 14:29 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/16 "2022-01-11T14:29:05Z")

</div>

> [@BruceEmsworth1](#):
>
> to come up with a good backup and recovery mechanism.

they did 😉 its called [Projects](https://nodered.org/docs/user-guide/projects/) and it synchronizes your flows with a Github repository for backup purposes. Havent used it yet personally because i just started learning Github but read a bit about the feature in the link above.

---

<div class="post-metadata">

**Author:** ![BruceEmsworth1](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@BruceEmsworth1](https://discourse.nodered.org/u/BruceEmsworth1)\
**Post date:** [11 January 2022 14:31 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/17 "2022-01-11T14:31:56Z")

</div>

Interesting!  
So that gets the flows to Github, so far so good,  
How do I get them to my "normal" backup media, in my case a NAS drive?

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [11 January 2022 14:39 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/18 "2022-01-11T14:39:43Z")

</div>

@TotallyInformation had a backup script that runs on a schedule posted [here](https://discourse.nodered.org/t/node-red-backup-script-bash-rsync/37939)

my knowledge on linux is very limited .. maybe you can ask how to modify it to get the backups to your NAS

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [11 January 2022 16:56 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/19 "2022-01-11T16:56:59Z")

</div>

The files you need from the `.node-red` directory are as follows:

- `flows.json` (assumes new enough build to not include the hostname in the flow file name)
- `flows_cred.json`
- `settings.js`
- `.config.runtime.json` (assuming you have not put a `credentialSecret` in your settings.js)
- `.config.users.json` This contains information about some editor settings
- `package.json` (so you can just run `npm install` to add the node installed by the Palette Manager back)
- The full content of the `lib` directory (assumes you have created library entries at some point)

p.s. this is basically everything in the `.node-red` directory minus the `node_modules` directory which can be regenerated from the `package.json` so not 100mile away from my initial statement.

---

<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:** [12 March 2022 16:57 UTC](https://discourse.nodered.org/t/how-do-i-recover-my-flows-from-an-old-sd-card/56410/20 "2022-03-12T16:57:52Z")

</div>

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