Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
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
Brand Logo
  1. Home
  2. Hardware
  3. Raspberry Pi SD Card wear out?

Raspberry Pi SD Card wear out?

Scheduled Pinned Locked Moved Hardware
29 Posts 14 Posters 10.6k Views 12 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.
  • sundberg84S Offline
    sundberg84S Offline
    sundberg84
    Hardware Contributor
    wrote on last edited by
    #2

    Im running Domoticz on a RaPi. First i started out with an old unbranded sd card and as you have heard it failed and quite often as well. It went corrupt when it was writing and there was something happening. If the power went out or something the only sollution was a complete new flash.

    I upgraded to a new class 10 branded sd card - and this has been working without any stops for about a year. I have had several power cuts and it has survived that.

    Controller: Proxmox VM - Home Assistant
    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

    1 Reply Last reply
    2
    • Z Zeph

      I was thinking to migrate to the Raspberry Pi (and try out various controller software).

      However, I am hearing about problems with wear on SD cards; apparently the cards can fail after too many writes. There is no TRIM control as with SSD's, so there is limited ability to wear-level. So there are reports of periodic SD failures with 24/7 software running on a RPi. That would not be ideal for a home controller!

      Has anybody had problems with this? Is some controller software better than others in this regard? (The problem can be reduced by using RAM disk (tmpfs) for highly volatile files).

      YveauxY Offline
      YveauxY Offline
      Yveaux
      Mod
      wrote on last edited by
      #3

      @Zeph I'm running all my RPi's with readonly filesystem, and tmpfs.
      It all depends on your situation whether you need to persistently store a lot of data or can do with a ramdisk.
      Added benefit of running from ram is that you can pull the power at any time without the risk of corrupting the filesystem.

      http://yveaux.blogspot.nl

      1 Reply Last reply
      2
      • tbowmoT Offline
        tbowmoT Offline
        tbowmo
        Admin
        wrote on last edited by
        #4

        I've had a RPI-2 running for about a year now, without problems.. I've had a small tmpfs, where I store logs and a couple of other frequently written files (Like the counter from my electricity meter blink sketch), for backup it copies this specific file (counter info) to the sdcard every 15 or 30 minutes..

        I have thought about adding an external usb disk (I have some 2.5" disks from old laptops laying around) and use that for /var, specially after I've started using influxdb to collect sensor data. Just need to get a enclosure for that disk..

        gohanG 1 Reply Last reply
        2
        • epierreE Offline
          epierreE Offline
          epierre
          Hero Member
          wrote on last edited by
          #5

          I am trying this now:

          https://www.domoticz.com/wiki/Setting_up_overlayFS_on_Raspberry_Pi

          z-wave - Vera -> Domoticz
          rfx - Domoticz <- MyDomoAtHome <- Imperihome
          mysensors -> mysensors-gw -> Domoticz

          1 Reply Last reply
          0
          • A Offline
            A Offline
            arraWX
            wrote on last edited by
            #6

            I run domoticz and use influxdb to collect sensor data on a rpi 3. After 2 - 3 months I see SD card corruption and have to restore the SD card from a backup image. This approach is starting to become annoying.

            Did anyone find a good and stable way to run rpi 24/7 with influxdb (or other database) collecting sensor data?

            @tbowmo Do you use the tmpfs for storage of influxdb data also? Did you add an external disk? If so what is your experience with that approach?

            1 Reply Last reply
            0
            • tbowmoT Offline
              tbowmoT Offline
              tbowmo
              Admin
              wrote on last edited by
              #7

              @arraWX

              I use the SD card for influx databases, haven't moved on to using an external hdd yet, but have it in my plans.. Problem is that it just runs without problems right now, so I do not dare to mess with it :)

              1 Reply Last reply
              1
              • tbowmoT tbowmo

                I've had a RPI-2 running for about a year now, without problems.. I've had a small tmpfs, where I store logs and a couple of other frequently written files (Like the counter from my electricity meter blink sketch), for backup it copies this specific file (counter info) to the sdcard every 15 or 30 minutes..

                I have thought about adding an external usb disk (I have some 2.5" disks from old laptops laying around) and use that for /var, specially after I've started using influxdb to collect sensor data. Just need to get a enclosure for that disk..

                gohanG Offline
                gohanG Offline
                gohan
                Mod
                wrote on last edited by
                #8

                @tbowmo what sketch/hw do you use for the energy meter?

                1 Reply Last reply
                0
                • tbowmoT Offline
                  tbowmoT Offline
                  tbowmo
                  Admin
                  wrote on last edited by
                  #9

                  @gohan

                  I think it is this one https://github.com/tbowmo/energyPulseCounter (haven't touched for a couple of years now..)

                  node-red mangles the incoming data, and emits it as a mysensor "node" towards domoticz.

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    napo7
                    Hardware Contributor
                    wrote on last edited by
                    #10

                    I've found a neat project for such uses :
                    It's called "DietPi" : it's a debian based distribution available for Raspberry pi, Orange PI and many others.
                    Many advantages :

                    • It's really lightweight.
                    • By default, logs are not written on SD card but in a RAM FS.
                    • Dropbear as SSH server instead of (more) heavy openSSH.
                    • and at last, but not least : ability to set root filesystem as READ ONLY. This is a BIG pros because the extFS is really more robust when not mounted RW.
                      This way, you can still put your databases on another partition which would be more tolerant to power failures....

                    That's great for "IOT" which need to be powered-off without needing to shutdown linux. I use it for some "connected speakers" : I plug them, they start, I listen to music, and when I'm done, I unplug them ! Never fail !!

                    BUT, IMO for a home automation server, the best and only option is an UPS (uninterruptible power supply) : either an AC one, or a powerbank-like battery : some of them are able to charge and deliver their juice without failing.

                    gohanG 1 Reply Last reply
                    1
                    • franzelareF Offline
                      franzelareF Offline
                      franzelare
                      wrote on last edited by
                      #11

                      I have a few Raspi's runing.
                      I have had issues once that domoticz would act strange and when i rebooted, all changes i made to scripts and new devices were gone...
                      This was a card failing, but not fully failing, because when i put an backup back, the system would run for a while until it got to the cells with issues again and gave me trouble again...

                      so in my case not wearing out, but just bad memory cells on the card

                      1 Reply Last reply
                      1
                      • N napo7

                        I've found a neat project for such uses :
                        It's called "DietPi" : it's a debian based distribution available for Raspberry pi, Orange PI and many others.
                        Many advantages :

                        • It's really lightweight.
                        • By default, logs are not written on SD card but in a RAM FS.
                        • Dropbear as SSH server instead of (more) heavy openSSH.
                        • and at last, but not least : ability to set root filesystem as READ ONLY. This is a BIG pros because the extFS is really more robust when not mounted RW.
                          This way, you can still put your databases on another partition which would be more tolerant to power failures....

                        That's great for "IOT" which need to be powered-off without needing to shutdown linux. I use it for some "connected speakers" : I plug them, they start, I listen to music, and when I'm done, I unplug them ! Never fail !!

                        BUT, IMO for a home automation server, the best and only option is an UPS (uninterruptible power supply) : either an AC one, or a powerbank-like battery : some of them are able to charge and deliver their juice without failing.

                        gohanG Offline
                        gohanG Offline
                        gohan
                        Mod
                        wrote on last edited by
                        #12

                        @napo7 ho do you turn root fs as read only?
                        As ups at the moment I modded a normal ups with 2 USB ports from a pc case bracket powered by a voltage regulator directly from the lead acid battery, the ups is powered off but the battery charging circuit is supplying 12v to keep battery always charged. The drawback is the huge transformer in the ups is generating quite some heat (wasted energy) so I'm on the hunt for a suitable replacement, but hey I got that ups for free 😁

                        N 1 Reply Last reply
                        0
                        • dbemowskD Offline
                          dbemowskD Offline
                          dbemowsk
                          wrote on last edited by
                          #13

                          When I ran my Raspberry PI years ago, I blew through a couple cheap SD cards. I had read about the Pi and the problems that people had with SD cards wearing out, so I decided to do the external hard drive solution. I had a USB to multi-format HDD reader (IDE, and SATA) and just pulled an old hard drive that I had laying around to use for the OS. Basically all you put on the SD is the boot partition that you then point to the external HDD for the rest of the OS. When my RasPi died and I migrated to an Orange PI PC, I pretty much did the same thing. Now I run my Vera Plus as my main HA controller and only have the Orange running my OWFS stuff that my Vera accesses.

                          Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                          Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                          1 Reply Last reply
                          1
                          • gohanG gohan

                            @napo7 ho do you turn root fs as read only?
                            As ups at the moment I modded a normal ups with 2 USB ports from a pc case bracket powered by a voltage regulator directly from the lead acid battery, the ups is powered off but the battery charging circuit is supplying 12v to keep battery always charged. The drawback is the huge transformer in the ups is generating quite some heat (wasted energy) so I'm on the hunt for a suitable replacement, but hey I got that ups for free 😁

                            N Offline
                            N Offline
                            napo7
                            Hardware Contributor
                            wrote on last edited by
                            #14

                            @gohan If you are using dietPi, you just have to run the command "dietpi-drive-manager" (sorry not sure of exact spelling, I'm not near a dietpi !)
                            Then, you'll have a menu that will allow you to choose per-partition read only or read-write.

                            @dbemowsk That's a good point to avoir SD wear-out, but it didn't avoided me the corrupted ext4 partition on a power-fail.
                            That's why I did choose to set the root partition as RO, so I'm sure the system will not hang at startup because of "partition not clean, cannot mount it" ;)

                            dbemowskD 1 Reply Last reply
                            0
                            • gohanG Offline
                              gohanG Offline
                              gohan
                              Mod
                              wrote on last edited by
                              #15

                              I'll give it a try. How about the users' folders? Aren't they in the root partition?

                              N 1 Reply Last reply
                              0
                              • gohanG gohan

                                I'll give it a try. How about the users' folders? Aren't they in the root partition?

                                N Offline
                                N Offline
                                napo7
                                Hardware Contributor
                                wrote on last edited by
                                #16

                                @gohan No they should'nt, as soon as they need to be modified.

                                There is probably better filesystems which are powerfail-resistant, but I'm not an expert and can't name any of them !
                                The main subject is still applicable : beware of wear ! Userdata which moves frequently such as databases should not be on a sd-card. Why not on an external HDD (or SSD...)

                                1 Reply Last reply
                                0
                                • N napo7

                                  @gohan If you are using dietPi, you just have to run the command "dietpi-drive-manager" (sorry not sure of exact spelling, I'm not near a dietpi !)
                                  Then, you'll have a menu that will allow you to choose per-partition read only or read-write.

                                  @dbemowsk That's a good point to avoir SD wear-out, but it didn't avoided me the corrupted ext4 partition on a power-fail.
                                  That's why I did choose to set the root partition as RO, so I'm sure the system will not hang at startup because of "partition not clean, cannot mount it" ;)

                                  dbemowskD Offline
                                  dbemowskD Offline
                                  dbemowsk
                                  wrote on last edited by
                                  #17

                                  @napo7 corrupted ext4 on what? the SD card or the HDD? If it is just a corrupted sd card, all you need to do is create another one and point it to the HDD for boot and you should not loose anything. If it is an ext4 on the HDD that is corrupted from a power failure, there are ways of repairing it e.g. fsck.

                                  Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                                  Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                                  1 Reply Last reply
                                  0
                                  • N Offline
                                    N Offline
                                    napo7
                                    Hardware Contributor
                                    wrote on last edited by
                                    #18

                                    Yes, I know that fsck repair the partition, but it's not really convenient to run a fsck at 4' AM because the server has crashed and doesn't want to startup because of corrupted FS ;)

                                    dbemowskD gohanG 2 Replies Last reply
                                    0
                                    • N napo7

                                      Yes, I know that fsck repair the partition, but it's not really convenient to run a fsck at 4' AM because the server has crashed and doesn't want to startup because of corrupted FS ;)

                                      dbemowskD Offline
                                      dbemowskD Offline
                                      dbemowsk
                                      wrote on last edited by
                                      #19

                                      @napo7 That is true with any server. So if you want to prevent those things from happening when there is a power failure, you put a UPS on it. Otherwise you live with the FSCK option. Simple math.

                                      Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                                      Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                                      1 Reply Last reply
                                      1
                                      • N napo7

                                        Yes, I know that fsck repair the partition, but it's not really convenient to run a fsck at 4' AM because the server has crashed and doesn't want to startup because of corrupted FS ;)

                                        gohanG Offline
                                        gohanG Offline
                                        gohan
                                        Mod
                                        wrote on last edited by
                                        #20

                                        @napo7 https://www.aliexpress.com/item/10W-3-7V-4-2V-Charger-5V-6V-9V-12V-Discharger-Board-DC-DC-Converter-Boost/32816412117.html

                                        1 Reply Last reply
                                        0
                                        • mfalkviddM Offline
                                          mfalkviddM Offline
                                          mfalkvidd
                                          Mod
                                          wrote on last edited by
                                          #21

                                          Has anyone looked at using f2fs? Support is supposedly available for Raspberry pi now. It's on my list of things to investigate, but I haven't gotten aroud to it yet.

                                          Guide: http://whitehorseplanet.org/gate/topics/documentation/public/howto_ext4_to_f2fs_root_partition_raspi.html

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


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular