[Tipz] tmpfs filesystem on Linux

Jay Sekora jay at ccs.neu.edu
Mon Mar 31 17:21:17 EST 2003


Adding the following line to /etc/fstab on a Linux box will get you 
a filesystem in RAM:

    tmpfs                   /ram            tmpfs   size=8M,mode=1777 0 0

Of course, it loses all its data on reboot (which is why you have to
specify a mode at mount time - changes to the permissions would be made
to the root inode, which goes away.)

Why would you want this?  One possible reason is speed, for something
that does heavy file I/O.  (I haven't tried compiling a kernel in tmpfs,
but I bet it would be noticeably quicker.  On the other hand, I'd lose
the time taken to copy all the source there.)  Another would be security
- files you create there and then delete are gone (unless they've been
read into memory by some process that gets swapped out - and if you're
paranoid and have enough ram you could turn off swap).

I use /ram, but you could do this with /tmp as well if you don't mind
it going away when you reboot.  (Of course, that's why it's called /tmp,
and this used to be standard practice on Solaris and SunOS machines.)

-Jay



More information about the Tipz mailing list