0

You have probably read the Raspberry Pi: Extending the life of the SD card article on zdnet by now. It features this line:

tmpfs    /var/log    tmpfs    defaults,noatime,nosuid,mode=0755,size=100m    0 0

However, I'd like to improve and just:

ln -s /tmp /var/log
user1095108
  • 239
  • 1
  • 9
  • 1
    Well, they both mean you will loose the files on shutdown -- so if you wanted to look through the logs after a system crash you will be out of luck. Note that ZD net article was written 10 years ago and I'm inclined to believe the "SD lifespan problem" had more to do with the quality of the SD card reader on the earlier models (although I've never tried to research that in depth). You might also want to consider the hype vs. the reality of this "problem": https://raspberrypi.stackexchange.com/questions/28842/reading-from-sd-card-all-day-long-risks/28844#28844 – goldilocks Mar 25 '24 at 12:10
  • 1
    How many SD Cards have you had fail? I still use 12 year old cards; this is one of the Pi urban myths and you would be better to spend your time on something else. – Milliways Mar 25 '24 at 21:53
  • I believe a great many users don't care about logs and RPi is meant to be a kind of toy anyway. – user1095108 Mar 26 '24 at 10:01

1 Answers1

3

A problem with this is that /tmp isn't a tmpfs mount by default on the current version of the OS (or on the last one or the one before that). Have a look at mount | grep tmp.

Of course, you could link it to a directory in /run instead. However, you'll have to arrange to have it created first, unless you just want to symlink it to /run, which seems messy, and if all this is about saving the effort it takes to add a line to /etc/fstab, silly as well.1

A more serious problem is that, particularly if the system runs without re-booting for a while and/or does stuff that creates copious logs, that tmpfs space isn't free -- it comes out of your RAM. Tmpsf mounts are intended for temporary storage of small amount of rapidly and frequently accessed runtime data, which logs are not.


  1. I won't repeat the paranoid-delusionally angle mentioned in my comment on your question, but don't forget about that either.
goldilocks
  • 58,859
  • 17
  • 112
  • 227