[Beowulf] typical protocol for cleanup of /tmp: on reboot? cron job? tmpfs?

Jon Forrest jlforrest at berkeley.edu
Fri Aug 20 13:51:34 PDT 2010

On 8/20/2010 1:40 PM, Rahul Nabar wrote:
> What's the typical protocol about the cleanup of /tmp folders? Do
> people clean them on each reboot or at intervals with a cron (sounds a
> bad idea). I was always under the impression that a reboot cleans them
> but apparantly not on my CentOS distro, by default.

I have a cronjob that removes anything in /tmp and
in /scratch, which not everybody uses, that's older
than a week old. I determined this 1 week old policy
by asking my users what the maximum length of any
of their jobs could be. For some people this might
be longer, and for some it might be shorter.

Also, since an open file isn't actually removed, you
probably can't damage things if you guess wrong, although
the file might not be visible in a directory listing.

> One other option that I've seen mentioned is mounting /tmp on a tmpfs.
> Is that a good idea? The risk of using up too much RAM if a program
> gets out of hand writing to /tmp.

Right. I don't think this is a good idea for scratch
space for the reasons you mention. It does make sense
for things like compilers and other programs that
create very transient and small files.

Jon Forrest
Research Computing Support
College of Chemistry
173 Tan Hall
University of California Berkeley
Berkeley, CA
jlforrest at berkeley.edu

More information about the Beowulf mailing list