How to prevent journald to write logs to disk?

I am using Hass OS on a Raspberry Pi 4 with an SD-Card. In order to increase the life of my SD-Card, I do not want to write to it too often.

I increased the commit-interval of the recorder, and now what writes most often to the card is the journald.

I searched a lot, but

  • the journald.conf is on a read-only filesystem, so I cannot set Storage to volatile
  • I cannot remove or umount /var/log/journald
  • This link explains in general how to reduce life cycles, there is also a section about using “Log2Ram”, but I cannot install it on HassOS (again readonly file systems and some other issues).

In the end, what I found out is that I can use umount -l /var/log/journal/. When doing this, there are no more logs at all. When I restart journald, the folder /var/log/journal/ is recreated again, but this time on tmpfs, which is in RAM. But when I reboot the Pi, the log gets persisted again.

Is there really no solution to change journald to log to RAM only on Hass OS with a Pi?

I use high quality SD cards (I think SD card reliability is much better now) and excellent backups so I don’t worry about the number of write operations or an SD card failure.

In addition to the link you found for reducing writes, there is also this link.

But back to your original question,

I don’t know but I would not worry about it if I have backups I can trust.

Is there really no solution / no hints for this?

How long do you want the SD card to last?
Do you know how long it will last if you reduce the amount of writes to the SD card?
And what will you do when the SD card fails or becomes corrupt (because it or something else will fail eventually).

Both things I do not know. I hope it will last much longer, or why are there lots of documentations how to reduce the amount of writes to SD-cards?

Buy a new one, and restore a backup. Why are you asking?

However, I will call the umount -l after a reboot, if I do not forget.

Honest question - in the time it takes you to figure out this problem, wouldn’t you be better served just switching to an SSD?

It’s looking like the juice isn’t worth the squeeze.

3 Likes

That was kind of my point. It is a lot of effort for nothing if you have a good backup that can be used for a quick recovery.

Here a 128gb ssd cost less than 20euro/dollar, about an hourly salary, or 10 liters of gasoline , or less than 3 packets of cigarettes :money_mouth_face: