My experience of early RaspberryPi based systems is that the memory card is easily corrupted if the system is not powered down properly before being turned off, for example, as the result of a power failure. This makes me reluctant to use any Pi-based system in an embedded environment and to prefer Arduino based systems which are much more robust in this regard, despite the limitations in computing power.
My question(s) to the community is(are) - have others experienced this issue? Is there something different about later Pi designs that solves this problem? Is there anything that others have done to fix the problem?
Richard - I have not experienced this issue but because of many odd issues I was experiencing (slowdowns, etc) a SD Card corruption was suspected.
I booted a Raspberry Pi with a different SD card running the standard Jessie image, plugged the suspect SD card into a USB SD card reader and then ran the fsck command to check for errors or issues.
The Arduino’s are still better for small embedded repetitive jobs predominantly because they do not have an OS, just firmware, simpler and more reliable.
But having said that the SD card tech has got better and the Pi software has got better so there has been a marked improvement since the Pi’s launch. the wear on SD 's is done by excessive writes and a majority of the damage to corrupt cards is due to a power interuption during a write cycle.
This project optimizes sd card life by reducing writes to disc using RAM to buffer data and performing fewer writes, the OS is also adapted to operate Read-only so that all but essental writes are eliminated to reduce the odds of the OS being in a write cycle when power is removed. It isn’t absolutely safe (few things are!) but for many, it is no longer a real concern.
You can take further steps like using a usb stick in place of the data partition, that pretty much make the whole sdcard read-only and only the usb stick is at risk of power related corruption. Or you can even put the whole filesystem and data on a small spinning disk hdd and reduce the risk even further.
Our emonSD pre-built SD card for our raspberryPi base stations (emonPi / emonSD) have got the root file-system setup to run in the read-only mode with log files going to a ram disk and a carefully controlled R/W data partition. Since moving to this setup we have not ha any reports of SD cards corrupting. I’ve had cards running for over 2-3 years and counting.
Thank you Glyn. That is very helpful to know. My concern arose from a ‘Squirrel Cam’ project I did with a Pi and a webcam about 3 years ago which kept crashing and corrupting the card. I can see that you, however, have the issue fully under control.