raspbian "jessie" (from the Lite image)
The raspberry pi is set up as a router/firewall between the home LAN and the internet (see Using a Raspberry Pi 2 Model B as a router/firewall for the home LAN for more detail).
It worked much as I expected it for most of May, but for the last week or so, it has stopped persisting file system changes to the SD card. I.e. the system behaves normally when booted and there are no obvious error messages, but after a reboot everything created since the previous reboot is lost.
Is this behaviour known? Does it mean the SD card is hosed? Is recovery possible? What should I do? fsck? fsck followed by fstrim? Just fstrim? Something else?
I've done a bit of googling and found contradictory information, from a blogpost that advices me to put /var/log on tmpfs, to the first comment to this stackexchange which indicates that in normal use, a 16GB SD card should last approximate 27 years.
What happened was this:
- On June 1 my mosh session to the raspberry pi startet misbehaving: it said file not found on commands I tried to run, and even failed to log out
- I tried to log in using the console (ie. the USB keyboard and the HDMI monitor physically connected to the raspberry p), but that login failed to complete. The monitor was full of kernel error messages, mentioning ext4 (I didn't take a picture unfortunately)
- I pulled the power and reconnected the power on the raspberry pi, and it booted normally, and seemed to behave normally
- Then I noticed that "apt-get dist-upgrade" tried to install the same packages twice, and the third time this happened, I found that it was the reboot that caused dist-upgrade to want to install the same packages again (since one of the packages was the kernel, a reboot seemed like a natural thing)
- I then tried to just create a file, and then rebooted, and the file was gone
(which isn't optimal...)