# How big is too big for a flow?

**URL:** <https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442>\
**Category:** General\
**Created:** [23 April 2019 05:16 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442 "2019-04-23T05:16:17Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [23 April 2019 05:16 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/1 "2019-04-23T05:16:17Z")

</div>

I have a project that has grown quite large and I tried to make a backup by exporting each flow to a text file that I could import from backup if needed. But it won't. The text file of my main flow is 62Kb and it won't import to another RPI. (I was just testing the backup).

Should I just take the time to break it into more, smaller flows? Is there a better way to save my flows?

---

<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:** [23 April 2019 06:12 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/2 "2019-04-23T06:12:04Z")

</div>

Exactly how are you writing to file and importing it again?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [23 April 2019 08:12 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/3 "2019-04-23T08:12:10Z")

</div>

> [@SteveMann](#):
>
> text file of my main flow is 62Kb and it won't import to another RPI. (I was just testing the backup).

Urm, that isn't big. Even my test flow is 157k. I'm away from the house at the moment so I can't check the live flows.

---

<div class="post-metadata">

**Author:** ![StrongTown](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@StrongTown](https://discourse.nodered.org/u/StrongTown)\
**Post date:** [23 April 2019 15:00 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/4 "2019-04-23T15:00:00Z")

</div>

To back up my entire NR program (19 tabs, around 400 nodes) I simply copy all the files in /home/pi/.node-red/ (certainly the code file {flows\_"xxxxx".json} where "xxxxx" is your system name (IE: "raspberry" maybe)) to a back-up directory (actually on my NAS, well and my PC too). To capture any persistent variables you store to file (IE: context.global.xxxx) also copy the "/context/" directory and its' files.

To restore simply copy all those files back to where you copied them from (into "/home/pi/.node-red/" directory) and restart NR.

st

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [23 April 2019 17:05 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/5 "2019-04-23T17:05:19Z")

</div>

> [@Colin](#):
>
> Exactly how are you writing to file and importing it again?

I've always exported the flow to the clipboard then saved it in a text file (and later import from clipboard). It works on all smaller flows, which is why I am wondering if there is a size limit that I have overrun.

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [23 April 2019 17:10 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/6 "2019-04-23T17:10:46Z")

</div>

> [@StrongTown](#):
>
> To back up my entire NR

How would you simply back up individual flows?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [23 April 2019 17:19 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/7 "2019-04-23T17:19:03Z")

</div>

It what way did it not work? Please describe it in more detail so we have some idea of what you're hitting.

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [23 April 2019 23:14 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/8 "2019-04-23T23:14:55Z")

</div>

On the big flow, nothing imported. Not a single wire or node. The smaller flows imported OK, however.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [23 April 2019 23:21 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/9 "2019-04-23T23:21:00Z")

</div>

My 2 live flows are currently 621k (on a Pi2 with lots of other things running) and 387k (Pi3 also with lots running).

---

<div class="post-metadata">

**Author:** ![nlecaude](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nlecaude/32/25_2.png) [@nlecaude](https://discourse.nodered.org/u/nlecaude)\
**Post date:** [24 April 2019 00:27 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/10 "2019-04-24T00:27:38Z")

</div>

915kb here and it runs smoothly.

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [24 April 2019 04:39 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/11 "2019-04-24T04:39:04Z")

</div>

Yes, I do the same. Worked all the times when I tried to restore. Don't export, just copy.  
In addition, in all my "production" Pi's, I have a small mini sd card reader with an additional sd card. For smaller changes I copy the .node-red folder, after larger modifications, I run the sd card copy utility, gives a full working backup. Works perfect, I have tested to swap cards, just works as expected

(My largest flow is around 450k, running in a Pi 3)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 April 2019 05:02 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/12 "2019-04-24T05:02:11Z")

</div>

Hey Steve.

Yeah, "been there" myself.

As has been mentioned it is better to not get too worried. It can be done.

I have a little script I use:  
(Below)

You may need to edit some parts for paths, etc.

But then if you want to get anything back, you simple copy from the folder to your node-red folder.

Hope this helps.

```auto
#!/bin/bash
# ---------------------------------------
# Simple backup script v1.0
# ---------------------------------------

# Variables
myDate=`date "+%Y-%m-%d.%H.%M.%S"`
#backupFolderName="Backup_$myDate"
backupFolderName="$myDate"
backupSource="/home/pi/.node-red"
backupDest="/home/pi/Backups/NR"
backupFilter="*.j*"
backupExclude="lost\+found"

# Tell the user what we're working with
echo "The myDate variable contains: $myDate"
echo "A backup of $backupSource/$backupFilter will be made and stored in $backupDest/$backupFolderName"

# Begin backup
rsync -avz --progress $backupSource/$backupFilter --exclude=$backupExclude $backupDest/$backupFolderName

# We're done.
echo "Done!"
#return $?

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [24 April 2019 07:29 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/13 "2019-04-24T07:29:08Z")

</div>

> [@SteveMann](#):
>
> On the big flow, nothing imported. Not a single wire or node. The smaller flows imported OK, however.

Can you be more explicit what you mean?

Do you mean:

1. open the `Import Flows' dialog
2. paste in your flow
3. click import
4. nothing happens

If so, can you check the browser's javascript developer console for any error messages?

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [24 April 2019 17:38 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/14 "2019-04-24T17:38:25Z")

</div>

This is getting interesting.  
By the way, this is a very low priority- the flows _did_ import after all- but in new flows. And I think I know where I went wrong and assumed that NR wasn't importing the flows.

This project is over and not a high priority, I just wanted to save the flows for possible reuse next year. (NR was controlling an Easter-themed game and included RFID card readers, Alexa [for the voice], electromagnets and other challenges you would see in an Escape Room.)

My steps to import the saved flows were to create a new flow (Flow 3) then import from clipboard. clicked on "Current Flow" then Import::

 ![NR%20import%20steps](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/56599f2a2964bb4f09476656d11052e515a462a3.jpeg)

When I clicked on Import, I saw something new that I did not see before because I probably wasn't watching the screen:  
 ![NR%20import%20error](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/c1765f45bbb9de59579a4d7fae15b13e86eedcc6.jpeg)

And this was the result:  
 ![nr%20import%20step2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/62d2577f624c0a4483ce52c729ca0b8158a13011.jpeg)  
**So you can see why I thought nothing imported**.

After a few more attempts, I decided to try something else and clicked on the right-scroll of the flows tab, and I discovered that the flows _did_ import after all. In new flows.:  
 ![nr%20import%20step3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/7c41e7544d32d297029cc6878886bc1b8bb80667.jpeg)

_So, in conclusion..._  
Did the flow import into a new flow tab because I originally copied every node on a named flow?

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [24 April 2019 18:32 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/15 "2019-04-24T18:32:49Z")

</div>

Thanks for the script. I have another RPI that is running my personal wiki that I use to keep notes. (Sort of like a lab notebook, but with my memory, I can't keep track of what I did last month). I back up the Wiki database manually once in a while.  
I mount a thumb drive when the RPI starts up. All my database backups go there and not on the source SD card.  
But your script looks better and I will put it on my RPI with NodeRed.

Can I run a shell script from NR Dashboard? I would love to put a button labeled "Back-up" there.

---

<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:** [24 April 2019 18:38 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/16 "2019-04-24T18:38:10Z")

</div>

think .... exec node....  
but you are getting into self-licking lollipop territory here... as your flow now has to include the flow to back itself up... and you will probably want to use that on the next project also... etc... this is one of those things that's probably easier to run outside of Node-RED whenever you want.

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [25 April 2019 01:23 UTC](https://discourse.nodered.org/t/how-big-is-too-big-for-a-flow/10442/17 "2019-04-25T01:23:06Z")

</div>

> [@dceejay](#):
>
> self-licking lollipop

I hadn't heard that term in a while, but I grok.
