Where can I temporarily store large files?
/tmp and /var/tmp are publicly writable directories. Some people store files in these directories. While this is not the primary purpose of these directories, people are welcome to temporarily store files there as long as /tmp remains less than 5% full, and /var/tmp less than 70%.
/tmp is a RAM-disk used for small temporary files created by mail, news, editors, and compilers. This file system is implemented in the same memory used for running programs. If /tmp filled up, no programs could run on Eniac at all. For this reason, I don't want more than 5% of Eniac's memory to be used for /tmp.
/var/tmp is in the /var file system. This file system is used to store incoming and outgoing mail, print jobs waiting to be printed, and system log files. If /var fills up, all of these facilities will cease to function reliably until space is again available. I like to keep /var less than 70% full, to provide an adequate safety margin.
If you are going to store files in these directories, you should first check to see that /tmp is less than 5% full and that /var/tmp is less than 70% full.
% df /var/tmp Filesystem kbytes used avail capacity Mounted on /dev/id013a 262640 81052 155324 34% /var
The "capacity" column gives the amount used, so in this example /var/tmp is comfortably below 70%.
Then, transfer or create your files in /var/tmp, making sure that /var/tmp remains under 70% full. When you are done with those files, remove them before logging off! For example, if there is enough free space in /var/tmp, you can FTP files from an archive into /var/tmp, download them to your PC or Mac, and then delete the copies in /var/tmp.
Every couple of hours, /tmp and /var/tmp are checked automatically. If there is not enough space left in the filesystem, then a script is executed to clean the files from it.
Core files are removed first, followed by the files that haven't been accessed in several days. The script starts by removing the files that haven't been accessed in 7 days, then removes the files that haven't been acccessed in 3 days, and then removes the files that haven't been accessed within the last day. If the filesystem is still full, then the files that haven't been modified in several days are removed in the same manner.
If /tmp and /var/tmp are still full, then files are removed if they haven't been accessed in 12 hours, followed by files that haven't been accessed in 6 hours, followed by files that haven't been accessed in two hours. It will remove these files if they are not in use. Finally, if the filesystem is still full, it will remove the files that haven't been modified in 18 hours, followed by the files that haven't been modified in 12 hours.
The maximum limits are 5% for /tmp and 70% for /var/tmp.
Note: You can have files removed even if you are currently logged in an d running processes.
Here are the steps taken when cleaning up a temporary directory. Each step is only taken if the file system is too full after the previous step. Empty directories are always removed
- Remove core files.
- Remove files owned by people who are not currently running
processes
- time since last access > 7 days
- time since the file was modified > 7 days
- time since last access > 3 days
- time since the file was modified > 3 days
- time since last access > 1 day
- time since the file was modified > 1 day
- Remove files owned by people who are currently running processes
- time since last access > 7 days
- time since the file was modified > 7 days
- time since last access > 3 days
- time since the file was modified > 3 days
- time since last access > 1 day
- time since the file was modified > 1 day
- Remove files owned by people who are not currently running
processes
- time since last access > 12 hours
- time since the file was modified > 12 hours
- time since last access > 6 hours
- time since the file was modified > 6 hours
- time since last access > 3 hours
- time since the file was modified > 3 hours
- Remove files owned by people who are currently running processes
- time since last access > 18 hours
- time since the file was modified > 18 hours
- time since last access > 12 hours
- time since the file was modified > 12 hours
Files may be manually deleted from either of these directories at any time at my discretion, if system performance is affected or threatened.
