红联Linux门户
Linux帮助

linux mount tmpfs

发布时间:2008-04-29 00:15:56来源:红联作者:btchnia
I've always fought with creating a memory filesystem under linux. Too many possibilies: ramfs, romfs, cramfs, tmpfs and not enough (read no) documentation or help on how to do it. So here we go.

So I'm running the 2.6.18 kernel under Debian right now. YMMV. To create a temporary filesystem you do something like the following.

# make the mount point for our temporary filesystem
mkdir /mnt/tmpfs
# create and mount a 100 megabyte (100M) temporary memory filesystem
sudo mount -osize=100m tmpfs /mnt/tmpfs -t tmpfs

What Is It?
A filesystem is the underlying storage that allows programs to read and write files. A temporary filesystem is a filesystem that is not persisted to any physical media -- it only lives in memory. When you turn off your computer, it goes away -- USER BEWARE. So why use a filesystem that doesn't store your files? Because it is very fast. For systems which need space to keep temporary files, store logs, or other short-term space, temporary filesystems can be a big win.

Of course, temporary filesystems use system memory leaving less for the kernel disk-cache as well as program space. The size of a temp filesystem should be carefully selected and you may was to run some performance tests with different sizes to see how your application performs.
文章评论

共有 0 条评论