Re: Moving /tmp to tmpfs makes it useless
On Fri, May 25, 2012 at 11:11:06AM +0200, Salvo Tomaselli wrote:
> > Files which are written on a regular filesystem stay on memory. This is
> > called the buffer cache. Whenever they are not used and/or the system
> > needs to reclaim memory, they are trashed.
> > Files which are written on a tmpfs stay on memory. Whenever they are not
> > used and/or the system needs to reclaim memory, they are swapped.
> > See? No difference.
> You seem to forget that memory is not an unlimited resource, the
> system might need it for other things, and in that case a large
> tmpfs causes severe slowdown (and even complete freeze).
So what? If you write to a normal file system, it goes into the page
cache, which is pretty much the same as writing into tmpfs. In both
cases if you have swap configured, the data will get pushed to disk;
either to the file system or to swap, as memory requirements dictate.
The main advantage of tmpfs is that it gets wiped on reboot, and so it
prevents people and applications from thinking that they can keep
stuff in /tmp forever. It's also faster because a file system has to
do extra work to make sure the files are preserved after a reboot.