# Old code deploys after reboot

**URL:** <https://discourse.nodered.org/t/old-code-deploys-after-reboot/28803>\
**Category:** General\
**Created:** [23 June 2020 12:40 UTC](https://discourse.nodered.org/t/old-code-deploys-after-reboot/28803 "2020-06-23T12:40:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sallen135](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@sallen135](https://discourse.nodered.org/u/sallen135)\
**Post date:** [23 June 2020 12:40 UTC](https://discourse.nodered.org/t/old-code-deploys-after-reboot/28803/1 "2020-06-23T12:40:58Z")

</div>

Recently when my Pi restarts, the node red code that it loads is not the latest. I can make changes and deploy (both full and modified nodes) and the changes work and remain. If the pi restarts, these changes are no longer present. It keeps reverting to the same previous state.

Any ideas how to stop this?

EDIT: Also, it is only after the pi totally restarts. If I simply restart node red it keeps my latest changes.

---

<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:** [23 June 2020 14:04 UTC](https://discourse.nodered.org/t/old-code-deploys-after-reboot/28803/2 "2020-06-23T14:04:42Z")

</div>

- What version of NR and node.js? (see startup log)
- what model pi?
- what os are you running on the pi?
- how much free space on the SD card? (from terminal `df -h`
- in terminal issue `cd $HOME/.node-red` then a `ls -al` and copy the results
- in a reply:  
-- on a new line type three back-tics  
-- enter a new line and paste what you copied  
-- on a new line enter three mre back-tics

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [23 June 2020 14:17 UTC](https://discourse.nodered.org/t/old-code-deploys-after-reboot/28803/3 "2020-06-23T14:17:53Z")

</div>

Looks like your pis SD card is broken.  
The SD card will go in protection mode and can't be written anymore.

---

<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 June 2020 14:34 UTC](https://discourse.nodered.org/t/old-code-deploys-after-reboot/28803/4 "2020-06-23T14:34:36Z")

</div>

+1 for it being the card. I have had that a couple of times, it appears to work perfectly fine, you can write to files and then read the file back and all is well, until you power cycle at which point it goes back to square one. I think the RAM cache on the card still works but it can't write to the permanent store.

---

<div class="post-metadata">

**Author:** ![sallen135](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@sallen135](https://discourse.nodered.org/u/sallen135)\
**Post date:** [23 June 2020 17:59 UTC](https://discourse.nodered.org/t/old-code-deploys-after-reboot/28803/5 "2020-06-23T17:59:12Z")

</div>

That makes sense. Should I be able to easily test this? If I created a random file, then rebooted, if it was the SD card the file would be gone?

EDIT: Tried this, and file did not persist after reboot. Must be the SD card. Which also adds up because I recently starting using influxdb so I mustve stressed it.

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [23 June 2020 19:21 UTC](https://discourse.nodered.org/t/old-code-deploys-after-reboot/28803/6 "2020-06-23T19:21:30Z")

</div>

Make a copy with win32 disk image and you are up and running in a hour again.

For the future, buy cards that are much bigger then you need. The os has than more room to spread the wearing.  
And buy high endurance sd cards, they last much longer.

---

<div class="post-metadata">

**Author:** ![sallen135](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@sallen135](https://discourse.nodered.org/u/sallen135)\
**Post date:** [23 June 2020 19:26 UTC](https://discourse.nodered.org/t/old-code-deploys-after-reboot/28803/7 "2020-06-23T19:26:54Z")

</div>

Great advice, this SD card was from years ago. Looking into running influx on my PC with an SSD and just sending data to it from the pi so theres no writing at all on the pi's end. When I setup influx a few months ago I was worried about corruption, but the fact that I could deploy still threw me off. Didnt think about the RAM.

Thank you!

---

<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:** [7 July 2020 19:27 UTC](https://discourse.nodered.org/t/old-code-deploys-after-reboot/28803/8 "2020-07-07T19:27:08Z")

</div>

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