prevent-sd-card-corruption

The past showed that the cause of a broken receiver is often a corrupt sd card. This site gives some hints how to prevent the write access which is the main cause for sd card corruption

SD Card quality

A flash cell might write 20,000 times. Load levelling in the controller rotates the wear across lots of cells. To work for a long time, the manufacturer provides spare cells. You buy 16 GB but the card contains 18 GB or 20 GB. A cheap manufacturer saves money by providing only 16.0001 GB.
Dont buy the cheapest No-Name sd card. Industrial class cards should be the best for a OGN receiver.

The noatime Mount Flag (caution: for experts only!)

If the partitions are not mounted with the flag "noatime" then every read access is also a write access! Change the file "/etc/fstab" and mount the partitions with "noatime"

Disable Swap mechanism

sudo systemctl stop dphys-swapfile
sudo systemctl disable dphys-swapfile
sudo apt-get purge dphys-swapfile

OverlayFS

The OverlayFS makes the sd card read only. You can always enable or disable the read only file system. The only downside is that if you make changes, you have to remember to disable the OverlayFS before, because otherwise all changes will only live until the next reboot. When OverlayFS is enabled, writeable memory (visible to the system) drops to just under 500MB for a Raspberry 2 (with 1GB RAM). But that is quite enough for all "normal" logfiles that occur during operation. When OverlayFS is disabled, the complete SD card is writable as before.

There are many (complicated) ways to install the OverlayFS. Here is a simple way to install the OverlayFS for a Raspberry Pi:

cd /sbin
sudo wget https://github.com/ppisa/rpi-utils/raw/master/init-overlay/sbin/init-overlay
sudo wget https://github.com/ppisa/rpi-utils/raw/master/init-overlay/sbin/overlayctl
sudo chmod +x init-overlay overlayctl
sudo mkdir /overlay 
sudo overlayctl install 
sudo reboot

Now we can query the status of the OverlayFS:

sudo overlayctl status

… or enable OverlayFS:

sudo overlayctl enable
sudo reboot

… or disable OverlayFS

sudo overlayctl disable
sudo reboot
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License