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

Re: Idea: mount /tmp to tmpfs depending on free space and RAM

On Fri, Jun 08, 2012 at 04:59:14PM +0300, Serge wrote:
> 2012/6/8 Petter Reinholdtsen wrote:
> > [Wouter Verhelst]
> >> - You could mount your mail spool there, and make things go blazingly
> >>   fast [1]
> You could, but this is not related to /tmp.

Sure; that was a joke, after all.

> >> - There's no danger of a symlink attack or similar with things like
> >>   tmpreaper -- or indeed any need for tmpreaper anymore. You reboot the
> >>   system, and /tmp is clean again, no matter what was there before. This
> >>   is more than just a convenience.
> This works for many years. /tmp on disk is also cleaned on reboot.

Yes, but that does have its downsides:
- It can be surprising to those who don't know about that fact
  ("whaddaya mean, it's gone? This is disk, right?")
- Removing files takes time, especially if there's large amounts of
  files in that directory.

The two combined once made me wonder why booting my laptop took much
longer than usual after I had just restored some dozens of gigabytes
from bacula (which stores files in /tmp by default), and had forgotten
about the automatic cleaning.

When /tmp is in a tmpfs, it's easy to connect the dots if it's empty on
the next boot, and even easy to understand that restoring there (and
then rebooting) isn't going to be very helpful.

Also, the symlink attack thing isn't just something I made up;
tmpreaper's REAME.Debian actually warns about that.


The volume of a pizza of thickness a and radius z can be described by
the following formula:

pi zz a

Reply to: