Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. English
  3. ioBroker general
  4. How to lower disk writes (for extending life of an sd card)

NEWS

  • Jahresrückblick 2025 – unser neuer Blogbeitrag ist online! ✨
    BluefoxB
    Bluefox
    17
    1
    2.1k

  • Neuer Blogbeitrag: Monatsrückblick - Dezember 2025 🎄
    BluefoxB
    Bluefox
    13
    1
    941

  • Weihnachtsangebot 2025! 🎄
    BluefoxB
    Bluefox
    25
    1
    2.2k

How to lower disk writes (for extending life of an sd card)

Scheduled Pinned Locked Moved ioBroker general
states.jsonwrite interval
16 Posts 5 Posters 2.0k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Tomasz NowakT Offline
    Tomasz NowakT Offline
    Tomasz Nowak
    wrote on last edited by
    #1

    Hi,
    I'm new to ioBroker but I have been using FHEM, deCONZ, Node-RED, etc. before.
    I have successfully installed ioBroker in Docker (using Portainer) on yet another Raspberry Pi 3B+ in my house.
    It runs on Sandisk Industrial microsd card and and I'd like to to stay that way.
    I checked system disk writes with iotop and found out that iobroker.js-controller is writing relatively much to a files:
    /opt/iobroker/iobroker-data/states.json
    /opt/iobroker/iobroker-data/states.json.bak

    I understand, that this is a permanent json storage of in-memory states database and is written probably every 30 seconds.
    Is this (frequent interval) required for anything?
    My RPi3 won't be powered off so keeping all in memory is fine and if reboot happens I don't care about states or its history - they would be just read from devices(es) again.

    So my question is - how do I extend write interval to states.json to 8 or 24 hours?
    I didn't find such setting in iobroker.json

    paul53P apollon77A 2 Replies Last reply
    0
    • Tomasz NowakT Tomasz Nowak

      Hi,
      I'm new to ioBroker but I have been using FHEM, deCONZ, Node-RED, etc. before.
      I have successfully installed ioBroker in Docker (using Portainer) on yet another Raspberry Pi 3B+ in my house.
      It runs on Sandisk Industrial microsd card and and I'd like to to stay that way.
      I checked system disk writes with iotop and found out that iobroker.js-controller is writing relatively much to a files:
      /opt/iobroker/iobroker-data/states.json
      /opt/iobroker/iobroker-data/states.json.bak

      I understand, that this is a permanent json storage of in-memory states database and is written probably every 30 seconds.
      Is this (frequent interval) required for anything?
      My RPi3 won't be powered off so keeping all in memory is fine and if reboot happens I don't care about states or its history - they would be just read from devices(es) again.

      So my question is - how do I extend write interval to states.json to 8 or 24 hours?
      I didn't find such setting in iobroker.json

      paul53P Offline
      paul53P Offline
      paul53
      wrote on last edited by
      #2

      @Tomasz-Nowak sagte:

      how do I extend write interval to states.json to 8 or 24 hours?

      In file node_modules/iobroker.js-controller/lib/states/statesInMemFileDB.js search for 30000 and change it to a higher value (7 times). Then iobroker restart.

      Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
      Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

      1 Reply Last reply
      0
      • Tomasz NowakT Offline
        Tomasz NowakT Offline
        Tomasz Nowak
        wrote on last edited by Tomasz Nowak
        #3

        @paul53
        Thanks, works like a charm. I've put 28800000 for 8-hour save interval and instantly sd card writes dropped to almost zero on that PRI. Would be great if that interval could be configurable somewhere in the future

        paul53P 1 Reply Last reply
        1
        • Tomasz NowakT Tomasz Nowak

          @paul53
          Thanks, works like a charm. I've put 28800000 for 8-hour save interval and instantly sd card writes dropped to almost zero on that PRI. Would be great if that interval could be configurable somewhere in the future

          paul53P Offline
          paul53P Offline
          paul53
          wrote on last edited by paul53
          #4

          @Tomasz-Nowak sagt:

          Would be great if that interval could be configurable somewhere in the future

          Please create an issue on Github.

          Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
          Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

          1 Reply Last reply
          0
          • Tomasz NowakT Tomasz Nowak

            Hi,
            I'm new to ioBroker but I have been using FHEM, deCONZ, Node-RED, etc. before.
            I have successfully installed ioBroker in Docker (using Portainer) on yet another Raspberry Pi 3B+ in my house.
            It runs on Sandisk Industrial microsd card and and I'd like to to stay that way.
            I checked system disk writes with iotop and found out that iobroker.js-controller is writing relatively much to a files:
            /opt/iobroker/iobroker-data/states.json
            /opt/iobroker/iobroker-data/states.json.bak

            I understand, that this is a permanent json storage of in-memory states database and is written probably every 30 seconds.
            Is this (frequent interval) required for anything?
            My RPi3 won't be powered off so keeping all in memory is fine and if reboot happens I don't care about states or its history - they would be just read from devices(es) again.

            So my question is - how do I extend write interval to states.json to 8 or 24 hours?
            I didn't find such setting in iobroker.json

            apollon77A Offline
            apollon77A Offline
            apollon77
            wrote on last edited by
            #5

            @Tomasz-Nowak sagte in How to lower disk writes (for extending life of an sd card):

            My RPi3 won't be powered off so keeping all in memory is fine and if reboot happens I don't care about states or its history - they would be just read from devices(es) again.

            I don't know if it is really that easy as soon as you have more complex scripts with "Non device states". If you choose that way then you need to make sure that all your scripts can work with "missing" "outdated" state values ... this will be likely hard when you do not only use device values, but also logical values.
            So when you increase it that much - know what you are doing and which effects it has!!

            Beitrag hat geholfen? Votet rechts unten im Beitrag :-) https://paypal.me/Apollon77 / https://github.com/sponsors/Apollon77

            • Debug-Log für Instanz einschalten? Admin -> Instanzen -> Expertenmodus -> Instanz aufklappen - Loglevel ändern
            • Logfiles auf Platte /opt/iobroker/log/… nutzen, Admin schneidet Zeilen ab
            paul53P 1 Reply Last reply
            0
            • apollon77A apollon77

              @Tomasz-Nowak sagte in How to lower disk writes (for extending life of an sd card):

              My RPi3 won't be powered off so keeping all in memory is fine and if reboot happens I don't care about states or its history - they would be just read from devices(es) again.

              I don't know if it is really that easy as soon as you have more complex scripts with "Non device states". If you choose that way then you need to make sure that all your scripts can work with "missing" "outdated" state values ... this will be likely hard when you do not only use device values, but also logical values.
              So when you increase it that much - know what you are doing and which effects it has!!

              paul53P Offline
              paul53P Offline
              paul53
              wrote on last edited by
              #6

              @apollon77 sagte:

              this will be likely hard when you do not only use device values, but also logical values.

              A reboot / killing of ioBroker immediately writes the states from RAM to the file. Only in case of a system crash (power failure) such a long time is problematic.

              Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
              Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

              apollon77A 1 Reply Last reply
              0
              • paul53P paul53

                @apollon77 sagte:

                this will be likely hard when you do not only use device values, but also logical values.

                A reboot / killing of ioBroker immediately writes the states from RAM to the file. Only in case of a system crash (power failure) such a long time is problematic.

                apollon77A Offline
                apollon77A Offline
                apollon77
                wrote on last edited by
                #7

                @paul53 ... or a process crash (yes there is come code that tries to write it also when crashing) ... but :-) (e.g. a SIGTERM because of OOM might also not write values).

                It is all about "knowing what one is doing"

                Beitrag hat geholfen? Votet rechts unten im Beitrag :-) https://paypal.me/Apollon77 / https://github.com/sponsors/Apollon77

                • Debug-Log für Instanz einschalten? Admin -> Instanzen -> Expertenmodus -> Instanz aufklappen - Loglevel ändern
                • Logfiles auf Platte /opt/iobroker/log/… nutzen, Admin schneidet Zeilen ab
                1 Reply Last reply
                0
                • Tomasz NowakT Offline
                  Tomasz NowakT Offline
                  Tomasz Nowak
                  wrote on last edited by Tomasz Nowak
                  #8

                  @paul53 , @apollon77
                  Thanks for your hints, guys. For now I'm just handling Ecovacs Deebot vacuuming robot (and Daikin aircon soon, probably) over MQTT with no logic within ioBroker. So I hope I don't risk any house disaster with that setting

                  @paul53, I've created an issue, thanks.

                  1 Reply Last reply
                  0
                  • DutchmanD Offline
                    DutchmanD Offline
                    Dutchman
                    Developer Most Active Administrators
                    wrote on last edited by
                    #9

                    just as suggestion, to avoid load read/write loads on storage and move the to Memory isn't Redis providing more efficient state handling here ?

                    1 Reply Last reply
                    0
                    • Tomasz NowakT Offline
                      Tomasz NowakT Offline
                      Tomasz Nowak
                      wrote on last edited by
                      #10

                      I thought about it but AFAIK Redis also needs to write to disk / sd card. I have relatively small number of states so I believe creating yet another docker instance for Redis would be kind of overkill in my case.

                      MicM 1 Reply Last reply
                      0
                      • Tomasz NowakT Tomasz Nowak

                        I thought about it but AFAIK Redis also needs to write to disk / sd card. I have relatively small number of states so I believe creating yet another docker instance for Redis would be kind of overkill in my case.

                        MicM Offline
                        MicM Offline
                        Mic
                        Developer
                        wrote on last edited by Mic
                        #11

                        @Tomasz-Nowak
                        I am using Redis successfully for several months. I have installed it on the same system (Debian) on which ioBroker is installed - but no Raspberry experience (I am using a Zotac barebone with Proxmox), though.
                        See: https://github.com/ioBroker/ioBroker.js-controller#state-and-objects-databases-and-files
                        Also, see: https://redis.io/topics/persistence
                        You may want to look into it again, but not sure how the performance is gonna be on a Raspberry.

                        Tomasz NowakT 1 Reply Last reply
                        0
                        • MicM Mic

                          @Tomasz-Nowak
                          I am using Redis successfully for several months. I have installed it on the same system (Debian) on which ioBroker is installed - but no Raspberry experience (I am using a Zotac barebone with Proxmox), though.
                          See: https://github.com/ioBroker/ioBroker.js-controller#state-and-objects-databases-and-files
                          Also, see: https://redis.io/topics/persistence
                          You may want to look into it again, but not sure how the performance is gonna be on a Raspberry.

                          Tomasz NowakT Offline
                          Tomasz NowakT Offline
                          Tomasz Nowak
                          wrote on last edited by
                          #12

                          @Mic
                          I've read that before. They say good for many objects such has 10000 for performance reasons. I have like 50 objects :)
                          And I don't want make it more complex (you don't install another services in docker instance, you need another docker)

                          1 Reply Last reply
                          0
                          • DutchmanD Offline
                            DutchmanD Offline
                            Dutchman
                            Developer Most Active Administrators
                            wrote on last edited by Dutchman
                            #13

                            guys wait ...., don't ix performance and io topics please :)

                            we are discussing write access to storage, Redis works in memory so less write on disk/card was my hypothese :)

                            paul53P 1 Reply Last reply
                            0
                            • DutchmanD Dutchman

                              guys wait ...., don't ix performance and io topics please :)

                              we are discussing write access to storage, Redis works in memory so less write on disk/card was my hypothese :)

                              paul53P Offline
                              paul53P Offline
                              paul53
                              wrote on last edited by
                              #14

                              @Dutchman sagte:

                              Redis works in memory so less write on disk/card

                              Per default Redis writes every 5 minutes to disk/card.

                              Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
                              Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

                              DutchmanD 1 Reply Last reply
                              0
                              • paul53P paul53

                                @Dutchman sagte:

                                Redis works in memory so less write on disk/card

                                Per default Redis writes every 5 minutes to disk/card.

                                DutchmanD Offline
                                DutchmanD Offline
                                Dutchman
                                Developer Most Active Administrators
                                wrote on last edited by
                                #15

                                @paul53 sagte in How to lower disk writes (for extending life of an sd card):

                                @Dutchman sagte:

                                Redis works in memory so less write on disk/card

                                Per default Redis writes every 5 minutes to disk/card.

                                Better than every 30 seconds 🤷‍♂️

                                MicM 1 Reply Last reply
                                0
                                • DutchmanD Dutchman

                                  @paul53 sagte in How to lower disk writes (for extending life of an sd card):

                                  @Dutchman sagte:

                                  Redis works in memory so less write on disk/card

                                  Per default Redis writes every 5 minutes to disk/card.

                                  Better than every 30 seconds 🤷‍♂️

                                  MicM Offline
                                  MicM Offline
                                  Mic
                                  Developer
                                  wrote on last edited by
                                  #16

                                  @Dutchman sagte in How to lower disk writes (for extending life of an sd card):

                                  Better than every 30 seconds 🤷‍♂️

                                  Exactly, and the default value can certainly be increased to whatever is needed. I would give Redis a try.
                                  Also,
                                  @Tomasz-Nowak sagte in How to lower disk writes (for extending life of an sd card):

                                  They say good for many objects such has 10000 for performance reasons

                                  I would assume this statement in the documentation was just made for the ease of use of ioBroker in general: Without like Redis, typically ioBroker's performance is good if you have way less than 10000+ objects. You are having a different use case (limited disc r/w per period). Not sure how the performance (like CPU and memory usage) of Redis is on a Raspberry, but I guess pretty low.

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  Support us

                                  ioBroker
                                  Community Adapters
                                  Donate

                                  710

                                  Online

                                  32.6k

                                  Users

                                  82.2k

                                  Topics

                                  1.3m

                                  Posts
                                  Community
                                  Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                                  ioBroker Community 2014-2025
                                  logo
                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Home
                                  • Recent
                                  • Tags
                                  • Unread 0
                                  • Categories
                                  • Unreplied
                                  • Popular
                                  • GitHub
                                  • Docu
                                  • Hilfe