Where to place/tmp /var/cache directories to avoid SSD usage

Begonnen von LRC1962, 2018/04/07, 12:52:16

Vorheriges Thema - Nächstes Thema

LRC1962

Because of the way SSDs are made, it seems the best idea is to place cache and tmp directories normally in root and put them on a SATA HD. I know that you can create a partition just for them, but is it possible to move them onto your/home partition?

dibl

NO, you do not want any files owned by root in your user's home directory.  The login manager will not permit the user to log in where root files are located.
System76 Oryx Pro, Intel Core i7-11800H, ASRock B860 Pro-A, Intel Core Ultra 7 265KF, Nvidia GTX-1060, SSD 990 EVO Plus.

melmarker

@LRC1962: the best place for /tmp is a tmpfs - the same might be true for a cache - otherwise one must write daily an insane amount of things to a modern ssd to destroy the device within the prospected life time of a ssd. And there is another thing to mention - i want it fast - thats why i use ssd's - and within 2-3 years there wll be faster, bigger and cheaper models, so it make no sense to limit writing to ssds.
Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety. (Benjamin Franklin, November 11, 1755)
Never attribute to malice that which can be adequately explained by stupidity. (Hanlons razor)

dibl

#3
If it makes you feel better about the SSD, you can  add these lines to your /etc/fstab file:

none                                          /tmp                 tmpfs        defaults,noatime,mode=1777                    0    0
none                                          /var/tmp             tmpfs        defaults,noatime                              0    0
none                                          /var/spool           tmpfs        defaults,noatime                              0    0


You could do the same with /var/log but you will never have a history of logged information because it will be lost every shutdown..

For browser or other user caches, there is a temporary user folder created at boot time at /run/user/nnnn, where "nnnn" is the user ID number, for example 1000 for the first user.  You can make a directory there and set your browser to use that for the cache directory, according to the browser's settings for cache location.  This cache will also disappear at shutdown, which may be a good thing for some users.  ;-)
System76 Oryx Pro, Intel Core i7-11800H, ASRock B860 Pro-A, Intel Core Ultra 7 265KF, Nvidia GTX-1060, SSD 990 EVO Plus.