[lug] RAM based files, file systems

Matthew Snelham infinite at sigalrm.com
Wed Jan 28 13:13:17 MST 2004


On 27 Jan 2004 09:42 PM or thereabouts, Jordan Crouse wrote:
> > Kind of like /proc, but where users can write small temp files
> > for better performance.
> 
> tmpfs is your friend, then.   Check out
> Documentation/filesystems/tmpfs.txt for all the nasty details.

tmpfs or ramfs are *exactly* what you're looking for.  They best part is,
they're dynamically allocated (so you never use more VM than the size of
files actually being written, as opposed to a ramdisk, which hacks off a
chunk of physical RAM, making it unuseable for the rest of the system!) 

here's a nifty intro to tmpfs: 
http://www-106.ibm.com/developerworks/library/l-fs3.html

And a quick example:

# grep tmpfs /proc/filesystems
nodev   tmpfs
# mkdir /mnt/tmp
# mount -t tmpfs tmpfs /mnt/tmp/ -o size=100m
# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/md/0                46636     11396     32832  26% /boot
/dev/md/1              7874560   6146496   1328048  83% /
10.1.0.23:/nova/home
                      58095204  54425324    718744  99% /home
tmpfs                   102400         0    102400   0% /mnt/tmp
#

And viola! Your own completely disk-free filesystem.  One more command:

# umount /mnt/tmp

... and any and all traces of your hard-earned data is gone forever. So,
careful. ;-)

--Matthew
infinite at sigalrm.com

--
   "Avoid employing unlucky people - throw half of the 
    pile of CVs in the bin without reading them."



More information about the LUG mailing list