What's the best way to stop /tmp from filling up?
This has happened to me several times: my /tmp directory becomes full, and then programs start crashing and failing to start. What do I do to prevent this?
About this post
- Posted
- Archived
- Score
- 8 · 100% up
- Kind
- Text
- ID
- d5ppgi
12 comments
Find out and fix whatever is dumping shit in /tmp and not cleaning it up. It's not "normal" behavior for /tmp to fill up.
Not a bad idea, lol. Thanks. Didn't realize it was that abnormal, but I probably should have.
Okay well it just happened again, and
lsoftold me that the Battle.net client had a bunch of "anonmap" file descriptors open, that were originally created in /tmp. I exited that, then also killed wineserver (as Battle.net is a Windows app) and that instantly brought me all the way from 0 bytes free (out of 7.8G) up to 6.2G free. So thanks again. :)Now I'm curious, is it a resource leak of some kind in Battle.net that translates over to /tmp wastage, or is there a bug in Wine that's doing it?
What do you mean it becomes full? It's directory for temporary files. Programs store there, nomen omen, temporary files which are deleted after reboot.
It starts giving errors saying there's no more space on the "device", then when I do
df -h, it says it's full.And what is the content of the /tmp when you encounter this problem?
EDIT: "encourage"...
/tmp is a ramdisk typically set to half of your system RAM. It's pretty abnormal for it to fill unless you've got a rogue app or very little total memory. Find out what app is dumping large files to it and change that app to use a different temporary storage location (that's not in-memory).
dont forget. wipe the /porn directory once a week too...
Clearly you need to reduce boot time so you can reboot more often /s
What I'd probably do if I was in your shoes was to narrow down what is filling tmp up, by either checking it when it becomes full or trying to trackback what I used in the session.
If I can narrow it down to a single program, either add a hook script to clean tmp after it closes or fix the program somehow.
If all else fails, probably making a somewhat decent disk partition (yay lvms) and syslink it as a workaround with what I assume powered by the raging anger of the community because of how bad of a plan that is
Did you explcitely set its size in
fstab? If so, increase it or remove the cap. Other alternatives are rebooting more often or delete it periodically, though this could possibly cause instability for open applications.No matter which option you choose, it is probably good idea to find out what is filling it up, as typical system usage does not fill it up very quickly.
Obtain more RAM, try using zram, or find the problem cause. You practically have an application leaking "memory" (/tmp disk space). Solve that, obtain more RAM, or set it to be a freshly formatted partition every boot.
The best way is whatever you want.
https://wiki.archlinux.org/index.php/Tmpfs