On 02/12/2019 12.51, Dave Howorth wrote:
On Mon, 2 Dec 2019 11:59:41 +0100 "Carlos E. R." <robin.listas@telefonica.net> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 02/12/2019 09.17, Per Jessen wrote:
My systems need to write something every minute. They're generally monitoring various sensors.
Can't the writing be delayed?
Depends what you're doing. IMHO, systemd's way of writing to the journal is smart enough to make the journal persistent, but there's lots of other logging, such as apache access logs, that can safely be done to RAM. There's a project called log2ram that's quite useful - there are various flavours of it.
Another way to minimise writes is to use bigger SD cards. I've standardised on 32GB Sandisk cards at the moment since they seem to be a reasonable price. Lots of spare space means lots of wear-levelling.
My data logging system OpenEnergyMonitor (OEM) uses redis to buffer data and reduce the frequency of writes to SD card. That seems to work quite well.
There is some trick I read years ago, but I do not remember the details. It is done by the laptop-mode-tools package; it configures the kernel to delay all writes for some time, then write them all in a burst. The idea, when I read that, was to power down the rotating hard disk for minutes, even an hour, to conserve battery power; they were not thinking of flash media at the time. It seems curious we have not heard of a kernel tuning for flash write media :-? Mount option? Google "linux kernel tuning for flash media write" finds some, not recent. For the Pi: <https://www.raspberrypi.org/forums/viewtopic.php?t=850> Wild idea: have /var/log in tmpfs completely, then rsync to flash on another dir periodically :-? But this is absurd, the syslog daemon should have a tuning to do the same thing. -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar)