LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware - ARM (https://www.linuxquestions.org/questions/slackware-arm-108/)
-   -   Using tmpfs tricks to reduce SD card writes (https://www.linuxquestions.org/questions/slackware-arm-108/using-tmpfs-tricks-to-reduce-sd-card-writes-4175657420/)

forestcreature 07-15-2019 10:50 AM

Using tmpfs tricks to reduce SD card writes
 
I would be interested to know if and how others have used tmpfs to reduce frequency of writes to their SD cards, the idea being to maybe prolong SD card life by writing a lot of logs and stuff that doesn't need to persist to RAM.

/var/log is an obvious candidate to mount on tmpfs, but up to slackware 14.2 package management depends on a couple of directories in /var/log. I've mounted /var/log on tmpfs and have a bunch of symlinks made on boot in rc.local to new directories in /usr/local/var/log from /var/log/packages (.../removed_packages, /scripts, /removed_scripts, /setup). So far it's worked well, and left me with a useable amount of RAM.

With CLEANUP:-YES in sbopkg.conf and judicious removal of built trees and packages, building sessions into a /tmp mounted on large tmpfs also work.

Anything else? Source caches, browser caches &c.?

lamerix 07-15-2019 11:59 AM

Quote:

Originally Posted by forestcreature (Post 6015245)
I would be interested to know if and how others have used tmpfs to reduce frequency of writes to their SD cards, the idea being to maybe prolong SD card life by writing a lot of logs and stuff that doesn't need to persist to RAM.

/var/log is an obvious candidate to mount on tmpfs, but slackware package management depends on a couple of directories in /var/log. I've mounted /var/log on tmpfs and have a bunch of symlinks made on boot in rc.local to new directories in /usr/local/var/log from /var/log/packages (.../removed_packages, /scripts, /removed_scripts, /setup). So far it's worked well, and left me with a useable amount of RAM.

With CLEANUP:-YES in sbopkg.conf and judicious removal of built trees and packages, building sessions into a /tmp mounted on large tmpfs also work.

Anything else? Source caches, browser caches &c.?

I don't think slackware-current dosnt really depend on the stuff in /var/log ..but maybe some external tools still do. For stable ..yeah, Patric moved that stuff after 14.2's release. But the way you are donig things ...creating symlinks at boot should fix that.
Anyway, another thing you can do is using something like
Code:

commit=60
in fstab when mounting you root partition. Not sure if it works on all filesystems but it does on ext3,ext4. Long story short, this will make the filesystem sync every 60 seconds.
To save up some memory you may wanna look up zswap

dugan 07-15-2019 12:19 PM

As far as I know, this is the documentation on "Patrick moved that stuff":

https://www.linuxquestions.org/quest...6/#post5870498

forestcreature 07-15-2019 01:50 PM

Whoa, right! :D

Thank you for the update and for the tips on zswap and commit=XX

Exaga 07-16-2019 06:03 AM

Quote:

Originally Posted by forestcreature (Post 6015245)
I would be interested to know if and how others have used tmpfs to reduce frequency of writes to their SD cards, the idea being to maybe prolong SD card life by writing a lot of logs and stuff that doesn't need to persist to RAM.

Anything else? Source caches, browser caches &c.?

No is the answer. I haven't ever tried prolonging the lifespan of any of my SD cards because failure isn't something that's happened very often for me. I guess it's just luck.

Some SD cards that I've been using for years on RPi build systems are still going strong. I only use branded, high quality, SD cards. So perhaps that makes a difference towards longevity.

forestcreature 07-16-2019 07:01 PM

Quote:

Originally Posted by Exaga (Post 6015486)
Some SD cards that I've been using for years on RPi build systems are still going strong. I only use branded, high quality, SD cards. So perhaps that makes a difference towards longevity.

I've read similar experiences elsewhere so maybe it's more systematic than luck.


All times are GMT -5. The time now is 06:30 PM.