Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
PostgreSQL 9.3 beta: Federated databases and more
LWN.net Weekly Edition for May 9, 2013
(Nearly) full tickless operation in 3.10
/tmp is meant to be small, fast and ephemeral, with a purge across a reboot being acceptable or clean out if the file's not accessed for a day or so.
Of course if you *must* have a /tmp/humungeous then nothing to stop a mount under /tmp, or a symlink to fallow area, for you to fill.
/tmp and /var/tmp
Posted Mar 31, 2011 2:20 UTC (Thu) by k8to (subscriber, #15413)
2 - on Linux, at least (this is LWN) there is little advantage of tmpfs over a normal filesystem for tmp. Linux's filesystem layer is quite good about not needing to send out data to disk when unnecessary (a truly shortlived file may never see the disk at all), and for the longer lived or large file case you get perfectly reasonable behavior as well
Posted Mar 31, 2011 21:36 UTC (Thu) by jond (subscriber, #37669)
Posted Mar 31, 2011 12:57 UTC (Thu) by Cyberax (✭ supporter ✭, #52523)
And why shouldn't they?
Posted Mar 31, 2011 17:00 UTC (Thu) by vonbrand (subscriber, #4458)
Because /tmp is supposed to be off-limits for users, it being the place for system temporaries?
Posted Mar 31, 2011 17:54 UTC (Thu) by Cyberax (✭ supporter ✭, #52523)
Sticky bit for directories was specifically invented for the world-writable /tmp. Also, where should user processes store their temporary data (for example, if a user opens a .tgz file in Nautilus)?
/home might be on a slow NFS link, so it's an incorrect answer.
Posted Mar 31, 2011 19:43 UTC (Thu) by vonbrand (subscriber, #4458)
The user temporary files are supposed to go in /var/tmp
Posted Mar 31, 2011 19:56 UTC (Thu) by martinfick (subscriber, #4455)
Where do you get that rationale from? The FHS does not think so:
The /tmp directory must be made available for programs that require temporary files.
Programs must not assume that any files or directories in /tmp are preserved between invocations of the program.
IEEE standard P1003.2 (POSIX, part 2) makes requirements that are similar to the above section.
Although data stored in /tmp may be deleted in a site-specific manner, it is recommended that files and directories located in /tmp be deleted whenever the system is booted.
FHS added this recommendation on the basis of historical precedent and common practice, but did not make it a requirement because system administration is not within the scope of this standard.
Posted Apr 1, 2011 15:55 UTC (Fri) by k8to (subscriber, #15413)
Posted Apr 1, 2011 17:30 UTC (Fri) by nix (subscriber, #2304)
(FWIW I too have never heard this before. /tmp is transient: /var/tmp is not. That's all.)
Posted Apr 2, 2011 15:15 UTC (Sat) by vonbrand (subscriber, #4458)
The compiler is not a "normal user", it is a system program (run by normal users under their UID, thus the sticky bit on /tmp).
Posted Apr 2, 2011 17:11 UTC (Sat) by mpr22 (subscriber, #60784)
1) I notice you're still not bothering to provide a citation for "/tmp is for the system and off-limits to ordinary applications".
2) In my world, the C compiler is an ordinary user application, so should use filesystems in the manner appropriate to ordinary user applications.
Posted Mar 31, 2011 13:43 UTC (Thu) by jschrod (subscriber, #1646)
In my world, if one uses applications that place there temporary files in /tmp and produce several GBs of them, it is surely *not* gross user incompetence if one decides not to spend one's time trying to detect how each and every of these apps can be persuaded to place their temporary files somewhere else. Instead one just gives /tmp more space. In my world, this is called pragmatic. Maybe you've heard of that term, but with your quick judgement of others, there is some doubt about that.
Maybe that information is new, but setting aside a few hundred GBs of disk space for /tmp is not really a problem with today's disk sizes. The 90s are over, really. And in no way that stops /tmp from being purged at reboot time.
Btw, if I would really clean out every day all /tmp files not accessed in a day, my desktop would not function any more. /tmp cleaning while user sessions are active needs more care than such coarse treatments; it needs blacklists, and most often also longer retention times.
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds