I thought these were cleaned out during boot. But mine are growing, granted not exponentially every day, but still things are there from 1st install date.
My question is can I remove content from those two directories?
I understand there are tweaks that can be made in a sys config file to do it during boot, but so far they have gone over my balding old head.
I even tried finding out how in the SDB documents but didn’t find it(yet).
# Clear tmp directories separately, to make them easier to override
# SUSE policy: we don't clean those directories
d /tmp 1777 root root -
d /var/tmp 1777 root root -
into
# Clear tmp directories separately, to make them easier to override
# My policy: empty /tmp en /var/tmp on boot.
D! /tmp 1777 root root 1d
D! /var/tmp 1777 root root 1d
I find it instructive to have lsof list all open files on occasion, especially under /tmp and /home:
lsof -nP | grep tmp
lsof -nP | grep home
Usually on my system, it’s the web browser keeping hundreds of files opened in many subfolders, also the desktop environment (SeaMonkey and KDE/Plasma5 in my case).
It lets me gauge roughly whether maybe my SSDs are getting stressed a bit too much, if tmpfs-mounting might be in order, and how all-in-all-blazingly fast our Linux rigs have become.
Did this^^^ /etc/tmpfiles.d/ was empty
Then I change the lines in copied file
I changed the lines in the /etc/tmpfiles.d/tmp.conf However, the 'd’s in your lines were 'q’s in my file.See next code lines.
# Clear tmp directories separately, to make them easier to override
# SUSE policy: we don't clean those directories
q /tmp 1777 root root -
q /var/tmp 1777 root root -
See
man 5 tmpfiles.d
[/QUOTE]
Yeah that is part of what went completely over my head.
But after all is said and done, /tmp was cleared of things oldr that 1 day.
But> /var/tmp was not cleared of anything! it has things going back to 11/10/2108(install date) most of which are named like this
As the man page says, q is used for sub-volumes when using btrfs. When not. it is equal to d.
This q seems to be relative new. It is not in the 13.1 man page (which I happen to have on-line), but it is in 15.0. So somewhere in between …
Maybe the not working on /var/tmp has something to do with btrfs, I do not know. But all those old files can of course be removed manualy when they use a considarable amount of space.
Re-reading the thread, I see that I warned against removing /tmp and /var/tmp. That was not what you suggested, you asked if you could remove the contents of those without fear for problems. And you can. Specialy those (very) old ones, that will not be open anymore for amy process because the processes wil have stoppen long ago due to a shutdown. Only take care about programs that are created/used since last reboot…
“/tmp” only has files since the last boot. But my entry for “/var/tmp” doesn’t clean out everything. There are two older directories – presumably because they are still being accessed. It is clean enough for me.
Using D! instead of D makes sure that cleaning only will take place at boot. Which might be important when using 1d, using 7d might assure that no active files are deleted.
All this depends of course on how often a boot is done. When the system is “never” booted (meaning several days, maybe weeks between boots), cleaning on boot only may not be what you want. and thus the 7d and no ! is probably a good solution.
It is of course not for nothing that I point to the man page. Everybody should invent his own best solution depending on his computer’s way of life.
When you mean the q (which has a btrfs connection in it’s description), I can point you to the man page and my remark in post #, where I say “When not, it is eqaual tp d”. In other words, when you do not have btrfs, read q as if there stands d.
(BTW, I have the same in my 15.0, no btrfs, but q in /usr/lib/tmpfiles.d/tmp.conf).
Edit: I still can not explain why the cleaning works for /tmp, but not for /var/tmp.