Screenly Forum

Reduce writes to the SD card to a minimum

I am going to deploy some Screenly OSE RPis. I have read in many places that it is the regular writes to the SD card that cause the failure in most cases of any Raspberry installation, in some cases as early as in a month. So it is advised to eliminate all writes to the SD during normal operation.

It is clear for me that the uploaded assets reside on the SD card, occasional writes must be allowed, so I can’t make the whole card write protected as it is advised in many places.
Are there any system maintenance, logging or anything other that writes to the SD, that could be disabled (I mean both in the Screenly software and the Raspbian OS itself)
I would welcome any clues.

Another question. Can I move the SQLite database containing the assets and configuration of Screenly into the memory (RAM). So it would tolerate also frequent changes in the contents, I would add a script that would download the SQLite file from a server after each boot.

We already take a number of precautions in order to reduce load (such as disabling swap).

There are a few other things that you could potentially do, such as reconfiguring the system logs to log to tmpfs, but you might lose logs (unless you setup log shipping).

Another question. Can I move the SQLite database containing the assets and configuration of Screenly into the memory (RAM). So it would tolerate also frequent changes in the contents, I would add a script that would download the SQLite file from a server after each boot.

No, this is a very bad idea. The SQLite database is not written to very often (unless changes are made), so it’s somewhat moot. The assets are also mostly read-only (unless you upload new ones). Generally speaking, it’s writes that you should be worried about, not reads.

On the note of tmpfs, while that might be tempting, unless you’re using a swanky new Pi 4 with 2G+ of RAM, Screenly does require most of the memory as it is (given that it’s split with the GPU).

Hope that helps.

Thank you for the thorough reply. I will try logging to tmpfs, (it is not losing logs is my main concern when installing a couple of Pis 500km away, but the overall durability of the whole thing)

btw. I still could not convince Screenly OSE to run on my Pi 4 (2GB), though I have not yet spent much time with it. Do you know of a working installation on Raspbian Buster on a Pi4 ? If yes, how it was done?

We are yet to add official support for the Pi 4 as well as for Buster. In theory, it should work with Stretch on the Pi 4 too I presume, but we are yet to verify this.