# Memory based tmp - advantages?



## chavez243ca (Mar 1, 2010)

is there any advantage - or disadvantage for that matter - in having a RAM-based /tmp?


----------



## fronclynne (Mar 1, 2010)

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: 
Nothing survives a reboot, even the stuff you wanted to temporarily keep
If you have 1G in /tmp and you fill it up, that's 1G of memory/swap you might want for something else
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)).


----------



## vermaden (Mar 1, 2010)

> [*]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.


----------



## phoenix (Mar 1, 2010)

/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.


----------



## fronclynne (Mar 1, 2010)

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).


----------

