This gist provides a partitioing scheme and some tips to have a RO protected filesystem on your favorite distribution. It is well suited for Raspberry filesystem as it is stored on an SDCard.
On several Raspberries I got some failing filesystems after some months of use. Some of it were occasionally rebooted and often rebooted cleanly. Lot of writes to SD were done as it stored some databases. But from what I've read, most of sd card failure causes are :
now out of date on recent Raspberry firmware - it was solved in end of 2013
A
###sudden power loss
There is no read limit. For write limit it is ~100k.
For instance, it would take over 10 years to wear out an area on the SD Card on which a file of any size (from 512 bytes to maximum capacity) was rewritten 3 times per hour, 8 hours a day, 365 days per year. With typical applications, the endurance limit is not of any practical concern to the vast major
In an extreme use, with our previous file rewritten all minutes, 24 hours a day it would take less than 2.5 months to reach this limit.
More info can be found in Sandisk SD Card Prod Manual
https://cdn-shop.adafruit.com/datasheets/TS16GUSDHC6.pdf
number of write /block on SSD /SD
check errors on journalctl and move needed folders to ...
persistent logs when shutting down, unmounting /var/log won't be successful => it's not an issue as discussed here : https://bbs.archlinux.org/viewtopic.php?pid=1204644#p1204644
non persistent logs cf journalf.conf, si message d'erreur lorsque commane journalctl --boot=-1 bien vérifier que /var/log/journal existe
disable man-db service
sudo systemctl maks man-db.timer
# no need to disable man-db unit, it is just linked to man-db.timer that starts it periodically
man-db update must be done manually (it also must be updated on pacman pkg install)
sudo systemctl start man-db
disable logrotate service
issues : umount /var/log
sudo systemctl mask logrotate.timer
# no need to disable logrotate unit, it is just linked to man-db.timer that starts it periodically
logrotate must be done manually (it also must be updated on pacman pkg install)
sudo systemctl start logrotate
openhab2
Unable to update instance pid: /usr/share/openhab2/runtime/instances/instance.properties (Read-only file system)
Solution :
sudo mkdir -p /others_rw_flash/usr/share/openhab2/runtime/instances/
fs_rw /
sudo mv /usr/share/openhab2/runtime/instances/instance.properties /others_rw_flash/usr/share/openhab2/runtime/instances/
sudo ln -s /others_rw_flash/usr/share/openhab2/runtime/instances/instance.properties /usr/share/openhab2/runtime/instances/
In some cases it is not possible to remount system as read only
systemd timesyncd et systemcd 234 235, without timesync all ssl verification will fail because your clock will be in the past.
systemd
problem on ro fs, systemd needs rw permission on `/var/lib`
use chronyd
do not forget to trim clock on chrony startup
initstepslew 30 server ntp-serv.inrialpes.fr server 0.arch.pool.ntp.org
https://chrony.tuxfamily.org/manual.html
# enable it on netctl connection
cat /etc/netctl/hooks/chrony-service-dispatcher
#!/bin/sh
# Hooks to toggle chrony online state
ExecUpPost="systemctl restart chronyd"
ExecDownPre="systemctl stop chronyd"
https://raspberrypi.stackexchange.com/questions/26800/how-can-a-read-only-sd-card-get-corrupted-repeatedly [Sandisk SD Card Prod Manual]: http://www.convict.lu/pdf/ProdManualSDCardv1.9.pdf