Memory based tmp - advantages?

Pro:
  • It's very fast
  • It doesn't get crufty, since nothing survives a reboot
  • It puts otherwise unused memory/swap to use
  • To make more space in /tmp you just need to reconfigure and remount (no tedious mucking about with on-disk filesystems)
Con:
  1. Nothing survives a reboot, even the stuff you wanted to temporarily keep
  2. If you have 1G in /tmp and you fill it up, that's 1G of memory/swap you might want for something else
  3. If you decide you don't like it, you're going to have to find some space to put a real filesystem for /tmp

That said, I've been using tmpfs(5) on an old laptop for a couple of weeks without any problems (and before that I was using tmpmfs="YES" in rc.conf(5)).
 
[*]It doesn't get crufty, since nothing survives a reboot
This can be also achieved with clear_tmp_enable="YES" in /etc/rc.conf

[*]Nothing survives a reboot, even the stuff you wanted to temporarily keep
This is the PROPER behaviour of /tmp, if you want temporary things to survive reboot, you store them in /var/tmp, that the difference between them.
 
/var/tmp is where you should be storing temp files you want to access after a reboot. By definition, /tmp should be cleared at every boot.
 
phoenix said:
/var/tmp is where you should be storing temp files you want to access after a reboot. By definition, /tmp should be cleared at every boot.

You're talking procedure vs. behaviour & further /tmp policy is subject to local administrator's whims.

My point was that a memory or swap based /tmp will not persist regardless of policy (unless it has a backing file).
 
Back
Top