News for hackers. Stuff that matters.
Re:Tmpfs considered harmful by praptak on Wednesday September 12, 2012 @08:38AM (#4510301)
Minor disagreement about the following: "Everyone must worry about whether their files need to survive a reboot"

I believe there was never such expectation of /tmp. On many systems it's being wiped periodically or even when the user's last session ends. The example app(s) that use /tmp for drafts need(s) to be fixed.

Re:Tmpfs considered harmful by alexchamberlain on Wednesday September 12, 2012 @08:41AM (#4510310)
Totally agree, /tmp should be wiped at the end of each session.
Re:Tmpfs considered harmful by dredmorbius on Wednesday September 12, 2012 @06:51PM (#4513705)
The key is that it may be wiped. Files stored in /tmp are not guaranteed to survive boot. Whether or not they are there or not is a bit of a gamble (a regularly losing one should you choose tmpfs).
Re:Tmpfs considered harmful by sliverstorm on Wednesday September 12, 2012 @02:26PM (#4512169)
Agreed; this prevents establishment of expectations otherwise.
Re:Tmpfs considered harmful by alexchamberlain on Wednesday September 12, 2012 @02:46PM (#4512307)
Also prevents it filling up your disk.
Re:Tmpfs considered harmful by sehrope on Wednesday September 12, 2012 @08:56AM (#4510384)
This is exactly what I use it for on my desktop. I have any app that I don't want to maintain longterm history for it's internal files (ex: Firefox browser cache) pointed to /tmp (mounted as tmpfs). As an added bonus if you're running your OS on an SSD (which you should be) you don't have it thrashed by constant writes/deletes.

The memory size issue is basically a non-issue at this point (pair of desktop 16 GB DIMMS are ~$80 and laptop isn't that much more).

Re:Tmpfs considered harmful by RobAley on Wednesday September 12, 2012 @09:37AM (#4510551)
The memory size issue is very much still an issue. I happen to have globs of memory on my machine, but for the very reason that I have software to use it. If large tmp files start eating into the resources available to my programs, its an issue for me. Also, older hardware that has less memory available, and even newer hardware that can have more memory installed but with non-tech users who don't know how to upgrade it or even that its possible (or can't afford $80).
Re:Tmpfs considered harmful by vidarh on Wednesday September 12, 2012 @10:36AM (#4510858)
If it's an issue for you, you can simply umount the tmpfs and remove the entry for fstab. I think this is a good default - on all mystems these days, it's disk-io that's the killer, not running out of memory.
Re:Tmpfs considered harmful by mccabe on Wednesday September 12, 2012 @08:48AM (#4510339)
Surely thats what /var/tmp is intended for.
Re:Tmpfs considered harmful by praptak on Wednesday September 12, 2012 @09:06AM (#4510424)
By "that" you probably mean "temporary files preserved between reboots". I agree :)
Re:Tmpfs considered harmful by mmagin on Wednesday September 12, 2012 @11:08AM (#4510994)
The Linux FHS agrees too, that this should be the distinction between /tmp and /var/tmp.
Re:Tmpfs considered harmful by jaylevitt on Wednesday September 12, 2012 @11:08AM (#4510996)
I can verify this - on my Fedora 12 box, I accidentally set up a test MySQL database into /tmp. The test database grew into my blog, and it worked great till I rebooted. Then I learned lots about recovering data. (I make regular backups, of coures, but who backs up /tmp?)
Re:Tmpfs considered harmful by rwmj on Wednesday September 12, 2012 @09:03AM (#4510406)
Sure, but if the power goes down, there's at least a chance that I may be able to find that long email I was writing. With /tmp on tmpfs, it's gone.
Re:Tmpfs considered harmful by colanderman on Wednesday September 12, 2012 @09:22AM (#4510487)
That's why the GP considers mutt broken. Drafts should be stored in ~/.mutt or /var, not /tmp. Files in /tmp should not be expected to survive a process.
Re:Tmpfs considered harmful by rwmj on Wednesday September 12, 2012 @09:53AM (#4510639)
This is exactly the point of the posting. Every program has to be examined for this problem, and it forces a complex decision about the storage hierarchy onto every programmer.
Re:Tmpfs considered harmful by vidarh on Wednesday September 12, 2012 @10:40AM (#4510879)
Every program has had to be designed with this in mind for decades or be broken on any number of systems. This may be new behaviour for Fedora, but it's not a new thing on Linux, or for Unix-like systems in general.

It's not just systems that delete on reboot, but also systems set up with cron-jobs to regularly wipe /tmp, or sysadmins that will (rightfully) see /tmp as something that can be wiped at pretty much time.

Re:Tmpfs considered harmful by saurik on Wednesday September 12, 2012 @10:32AM (#4510832)
That's like saying "RAM considered harmful", because every time a developer has to think "do I just store this in memory, or do I sync it to disk" "it forces a complex decision about the storage hierarchy": /tmp is simply RAM that has the API of a file; it used to be implemented using a horrible kludge with files on disk that were periodically deleted, but with tmpfs the dream became a reality.
Re:Tmpfs considered harmful by ta12121 on Wednesday September 12, 2012 @03:56PM (#4512786)

    /tmp is simply RAM that has the API of a file
...which used to behave, physically, as disk, and now behaves as RAM. If I'm doing large file manipulations that require temporary files larger than RAM where should I put them?
Re:Tmpfs considered harmful by luser001 on Wednesday September 12, 2012 @05:26PM (#4513326)
According to the comments on the original article, that location is /var/tmp. Apparently it's some sort of convention/standard.

First time I've heard about /var/tmp.

Re:Tmpfs considered harmful by regularfry on Wednesday September 12, 2012 @04:07PM (#4512853)
/tmp. If it's tmpfs, it can expand into swap space.
Re:Tmpfs considered harmful by ta12121 on Wednesday September 12, 2012 @05:10PM (#4513250)
Swap is usually no bigger than two or three times your RAM. Disk in general is 10 to 100 times the size of your RAM.
Re:Tmpfs considered harmful by saurik on Thursday September 13, 2012 @01:30AM (#4514912)
You should take all of the space you previously felt acceptable to provide /tmp and allocate it to swap space. The history and semantics of that folder and how it relates to RAM, especially on systems that could not implement swap space, actually make this make sense: if you upgrade to tmpfs from "periodic deletion of /tmp" and are not increasing the size of your swap partition accordingly, you are doing something wrong.
Re:Tmpfs considered harmful by regularfry on Thursday September 13, 2012 @03:37AM (#4515156)
If you know you're going to need more space, you can just create a transient swapfile for the duration. Or use /var/cache, if you suspect you know better than tmpfs and the swap allocator.
Re:Tmpfs considered harmful by prodigal_erik on Wednesday September 12, 2012 @12:22PM (#4511407)
RAM really is a harmful kludge. Neither Turing machines nor lambda calculus call for some of an algorithm's state to suddenly be obliterated. The only reason we put up with it is that disk and SSD are so much slower.
Re:Tmpfs considered harmful by rwallace on Wednesday September 12, 2012 @03:09PM (#4512469)
Speed is not the only benefit of RAM. The internal data structures of most programs are gnarly messes of intertwined pointers, fragile, easily corrupted, hard to upgrade in place, almost impossible to fix when they break. The division between RAM and disk forces everything to be serialized at intervals to clean storage formats that can be reread for a fresh start. As a practical matter, that's a big enough benefit to justify enforcing the division at an API level even if disk were as fast as RAM.
Re:Tmpfs considered harmful by prodigal_erik on Thursday September 13, 2012 @12:43PM (#4517153)
The industry might produce less worthless crap without the crutch of "it's not quite unusable if you start over often enough".
Re:Tmpfs considered harmful by TylerE on Wednesday September 12, 2012 @05:52PM (#4513445)
I've never understood the obsession with Turing machines. It's like basing one's core belief of what a car is off one of Da Vinci's crazy wind-up things.
Re:Tmpfs considered harmful by cma on Wednesday September 12, 2012 @09:09PM (#4514227)
Ram is just state. Turing machines require a non-tape state machine mechanism. You could consider ram a part of that, 4 gigs corresponding to many many possible states.
Re:Tmpfs considered harmful by saurik on Thursday September 13, 2012 @01:32AM (#4514919)
Some people (I do not agree with this view) believe that applications should be universally persistent: so that they never "stop running" and never "lose data" even when the machine restarts or even if the programs are transferred between systems.
Re:Tmpfs considered harmful by gwillen on Wednesday September 12, 2012 @10:15AM (#4510746)
Do you consider distros that rm -rf /tmp on startup to be broken? If not, why not?
Re:Tmpfs considered harmful by rwmj on Wednesday September 12, 2012 @10:16AM (#4510754)
Firstly Fedora (<= 17) doesn't do this. It has a tmpwatch cronjob which deletes files after 10 days (/tmp) and 30 days (/var/tmp).

Secondly, no I don't think it's broken. But it doesn't in any way affect the fact that as a last resort I can reboot in single user mode and grab the precious mutt file before it gets deleted.

Re:Tmpfs considered harmful by mikeash on Wednesday September 12, 2012 @10:37AM (#4510861)
Every program has to be examined for this problem anyway, tempfs or otherwise, so I don't get the point.
Re:Tmpfs considered harmful by qznc on Wednesday September 12, 2012 @10:29AM (#4510818)
I'd vote for ~/.cache
Re:Tmpfs considered harmful by dubcroster on Wednesday September 12, 2012 @09:22AM (#4510488)
I can't help but find that to be an issue of the MUA rather than that of the filesystem.

Although I agree with your points, I find that the design of one application alone cannot be a justifiable point.

Re:Tmpfs considered harmful by chimeracoder on Wednesday September 12, 2012 @02:33PM (#4512215)
No, because /tmp is supposed to be assumed to be cleared on start up. If you want something to survive between reboots, /tmp is the last place you should put it, even if you're not using tmpfs.

I've never had a problem with this using mutt, but if I cared, I'd switch it to use /var/tmp.

Either way, if there's a problem, it's with the program, not the filesystem - no need to use a cannon to kill a fly.

Re:Tmpfs considered harmful by ps2000 on Wednesday September 12, 2012 @10:34AM (#4510846)
I remember myself creating cron jobs to free wasted /tmp space