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

Re: how to increase space for tmpfs /tmp



On 2012-04-03 13:54:55 +0200, Claudius Hubig wrote:
> Vincent Lefevre <vincent@vinc17.net> wrote:
> > On 2012-03-28 18:32:25 +0100, Roger Leigh wrote:
> > FYI, Firefox/Iceweasel uses /tmp for that. For instance, click on
> > a link to a PDF file to view it with a PDF viewer; the file is
> > stored in /tmp. It isn't even removed after the application is
> > closed (quitting Iceweasel has the effect to remove it, but the
> > browser can run for several days/weeks).
> 
> And they happily obey TMPDIR if set, so that each user on a machine
> (you brought that problem up in your other post) can redirect it
> whereever he wants.

which is bad for the following reason. One has /tmp and /var/tmp
with a different usage:
  * /tmp: guaranteed to be fast, but may be very limited in size.
    And it can (and often will) be clean-up at boot time.
  * /var/tmp: should have enough space (in practice not less than
    /tmp), but may be significantly slower than /tmp, and files
    survive reboots.
So, depending on what an application will do and will expect, it
should choose /tmp or /var/tmp, certainly not obey $TMPDIR, for
which the application doesn't know anything about it. Well, $TMPDIR
is good for libraries, to be controlled by applications, but not if
one has specific requirements. Applications can also have config
files, but not all of them do for the storage location of temporary
data.

Examples:
  * A mail message that is being composed: the temporary file should
    not be stored in /tmp, because in case of sudden power loss (this
    unfortunately happens), system crash or reboot, the work is lost!
    That's why I now have "set tmpdir=/var/tmp" in my .muttrc, after
    losing several messages I was writing.
  * Files temporarily stored by a web browser should also be in
    /var/tmp, possibly except if they are very small.
  * For GCC, /tmp should normally be used for speed reason.

The idea of everything being set up by an environment variable
(which is inherited) is a bad thing. For instance, if the tmpdir
Mutt variable didn't exist, I would have to set TMPDIR=/var/tmp;
but one can execute shell commands from Mutt, e.g. a compilation
(probably not the best example, but well...), and GCC would have
then be executed with TMPDIR=/var/tmp, making it artificially
slower.

Similarly, scripts that build large software and use mktemp should
specify the temporary directory explicitly instead of setting
TMPDIR globally, because one may still want GCC to use /tmp for
its temporary files.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: