Re: clean out /tmp?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael A. Peters wrote:
> Nothing in /tmp should be expected to survive a reboot.
> In fact, some people like to run /tmp as a tempfs (temporary file
> system) - only problem is, a tempfs can get full if you aren't careful.

So can a regular /tmp.

Modern tmpfs uses both memory and swap-space, depending on "memory
pressure" (whether the kernel thinks it has a better use for real memory
than using it for a particular tmpfs page). It has a
sysadmin-configurable maximum size: "the default is half of your
physical RAM without swap", but you can dynamically change that.

So you can add (some of) the disk space you would have used for /tmp to
swap space, and either reclaim a bit of space, or get extra protection
against /tmp or memory filling up.

I'd also note that there are worse things that can happen to a server
than /tmp getting full. For example, the filesystem containing
/var/spool on a mailserver. If you just have the one filesystem, then
/tmp filling that filesystem will obviously lead to /var/spool's
filesystem being full...

Putting this in /etc/fstab should work:
none           /tmp         tmpfs defaults,nodev 0 0

(You may not want to set nodev, or set noexec as well...)

See /usr/src/linux/Documentation/filesystems/tmpfs.txt or
http://lxr.linux.no/source/Documentation/filesystems/tmpfs.txt for more
details.

Finally, I'd note that the FHS explicitly *recommends* that /tmp be
cleared out on system boot, and requires that "Programs must not assume
that any files or directories in /tmp are preserved between invocations
of the program."
(http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES).

Hope this helps,

James.

-- 
E-mail address: james | "The letters are Elvish, of an ancient mode, but the
@westexe.demon.co.uk  | language is that of Microsoft, which I will not utter
                      | here. But this in the Common Tongue is what is said:
                      | By this or any other name, You are well and truly..."


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux