Which filesystem should I use

James Wilkinson ubuntu at westexe.demon.co.uk
Mon Apr 25 12:22:54 UTC 2005


Simon Burke wrote:
> /tmp = ramdisk (its faster and arguably more secure)

I've found tmpfs to be a better alternative for me. It works at the
virtual memory level, which means that the files will either be in cache
or in the swap space depending on memory pressure [1]. And the size is
variable: unlike ramdisk, which takes up exactly (say) 32 MB always, it
will only take what it needs, up to a default of half main memory.

And on Hoary, at least, /dev is tmpfs, so you're using the filesystem
anyway.

If you want to secure it (to be sure that people can't recover the
contents of /tmp once the machine has been rebooted) you need to get an
encrypted swap, anyway.

James.

[1] Memory pressure: how much a system "wants" memory. So if you have 1
GB of RAM, and the desktop just sitting there, there may well be memory
that's never been used (since you booted). There'll be a lot of memory
caching files you haven't touched for a while, because there's nothing
more productive for that memory to do.

That's low memory pressure. In this case, you might want temporary files
to be held entirely in memory, and tmpfs will do that.

If you have the same 1 GB of RAM, and five database instances with
thirty users, and a big Java process with a memory leak, and the
swapfile in constant use trying to fit everything in, you should
begrudge 32 MB of RAM that the system can't use for memory at all
because someone decided it might speed up a few temporary files. They
can go on to disk like the rest of the files, and that 32 MB might just
be enough to stop the system thrashing itself to death.

That's high memory pressure, and tmpfs will, as needed, keep the
temporary files on disk (unless they're being used so much that they
need to be in memory anyway).

Hope this helps.

-- 
E-mail address: james | "Land Rover say it is permanent, I say I have a
@westexe.demon.co.uk  | large selection of spanners and a big hammer..."
                      |     -- Derry Hamilton




More information about the ubuntu-users mailing list