Command to clean tmp at shutdown
According to http://docs.slackware.com/howtos:gen...ree_your_space, following command should be put in /etc/rc.d/rc.local_shutdown :
Code:
/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -print0 | xargs -0r /bin/rm -rf Code:
rm -rf /tmp/* |
so if the script fails the deleting process does not stop, because every file triggers a different rm process, i guess...
|
tmpfs is a better solution...
|
Because * does not expand hidden files by default (but can be changed).
BTW, tmpfs is much slower than ext3/4, etc. when it makes extensive use of swap. |
Quote:
Quote:
|
Quote:
In the ~15 years I've been using Linux as my main desktop OS, I almost cannot recall ever seeing it actually use swap... maybe back when my machine had 256Mb RAM and I was running StarOffice on KDE, but certainly not much at all in recent years. |
Quote:
|
Quote:
|
I think find/xargs does not introduce more security than the dotglob shopt but find/xargs is more portable and also works when there are too many files.
|
Quote:
However, 8 GB is not large enough for my temp files. I also use suspend to disk more than once per day. I think I'm far from getting rid of swap. |
Many years ago the ratio between memory speed and disk speed (latency + transfer rate) was low, and memory was VERY expensive - thus virtual memory (page swapped to disk) was plausible. However, since then, memory has become both fantastically cheap and fast, while disk speed has not even come close to matching those advances. 30 years back I was dealing with mainframe disks of 200 MegaBytes in size (quite large then) which had latencies of about 15 millisecs. Now disks are down to maybe 5 millisecs. Transfer rates are better, but maybe 30 to 100 times. Memory is millions of times larger and almost billions of times cheaper. So,, if your system starts swapping in any fashion, it will appear that your machine is driving through treacle. While it's true that SSD's are rewriting those rules, the issues they still have with write-cycles is a problem. Conclusion - don't use memory for temp files : they will increase the likelihood that you will use swap and die.
|
Quote:
Code:
/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -exec /bin/rm -rf {} \; |
Quote:
Code:
/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -exec /bin/rm -rf {} +; |
Quote:
what are you possibly doing with your machine to make this true? to everyone who is saying that tmpfs will cause your machine to swap: you can easily limit the size of a tmpfs. mine is limited to 1 gig, and I've never come anywhere near filling it. this is on a machine with 4gigs ram, and I haven't yet seen any swapping... or at least I haven't noticed it. |
Quote:
|
All times are GMT -5. The time now is 08:42 PM. |