Raspberry Pi SD Card wear out?
-
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.
-
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
-
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.
@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 😁 -
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.
-
@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 😁@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" ;) -
@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...) -
@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" ;)@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.
-
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 ;)
-
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 ;)
-
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 ;)
-
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.
-
Try using Berryboot on SD card with a USB /pen drive. It will help in SD card wear out and power out cases. I am running multiple Raspis with multi boot option on Berryboot (added advantage ) for the last 2+years. Not much of a problem till date. Lots of power outages here... No UPS support!
-
After a failure with a cheap sd card, I've been running Domoticz for around 3 years on a Sandisk SD card with strictly no change to file system/partitions/..., I've probably had around 100 power cuts during that time (it's Vietnam...) and everything is still fine.
I think it's related to the fact that's it's a Pi 1 Model B, so it's still using SD card and not micro SD, I'll soon move to a Pi3 so it might not end up with the same experience :) -
Perhaps not the best solution but easy for a beginner.
It's possible to use "Win32 Disk Imager" to make an image of the a RPi SD card and save on e.g. Windows PC. Explained here: https://computers.tutsplus.com/articles/how-to-clone-your-raspberry-pi-sd-cards-with-windows--mac-59294
If you make an image, e.g. after changes in openHAB or at selected times, can't this be used to restore the system?
I'm aware of that data colected since the last made image will be lost and the system is down during the process.