up | Inhaltsverzeichniss | Kommentar

Manual page for TMPFS(4S)

tmpfs - memory based filesystem

CONFIG

options TMPFS

SYNOPSIS

#include <sys/mount.h>
mount ("tmpfs", dir, M_NEWTYPE|flags, args);

DESCRIPTION

tmpfs is a memory based filesystem which uses kernel resources relating to the VM system and page cache as a filesystem. Once mounted, a tmpfs filesystem provides standard file operations and semantics. tmpfs is so named because files and directories are not preserved across reboot or unmounts, all files residing on a tmpfs filesystem that is unmounted will be lost.

tmpfs filesystems are mounted either with the command:

mount -t tmp swap directory-name

or by placing the line

swap directory-name tmp rw 0 0

in your /etc/fstab file and using the mount.8 command as normal. The /etc/rc.local file contains commands to mount a tmpfs filesystem on /tmp at multi-user startup time but is by default commented out. To mount a tmpfs filesystem on /tmp (maximizing possible performance improvements), add the above line to /etc/fstab and uncomment the following line in /etc/rc.local:

#mount /tmp

tmpfs is designed as a performance enhancement which is achieved by cacheing the writes to files residing on a tmpfs filesystem. Performance improvements are most noticeable when a large number of short lived files are written and accessed on a tmpfs filesystem. Large compilations with tmpfs mounted on /tmp are a good example of this.

Users of tmpfs should be aware of some tradeoffs involved in mounting a tmpfs filesystem. The resources used by tmpfs are the same as those used when commands are executed (for example, swap space allocation). This means that a large sized or number of tmpfs files can affect the amount of space left over for programs to execute. Likewise, programs requiring large amounts of memory use up the space available to tmpfs. Users running into these constraints (for example, running out of space on tmpfs) can allocate more swap space by using the swapon.8 command.

Normal filesystem writes are scheduled to be written to a permanent storage medium along with all control information associated with the file (for example, modification time, file permissions). tmpfs control information resides only in memory and never needs to be written to permanent storage. File data remains in core until memory demands are sufficient to cause pages associated with tmpfs to be reused at which time they are copied out to swap.

SEE ALSO

df.1v mount.2v umount.2v fstab.5 mount.8 swapon.8

[a manual with the abbreviation SSO],
[a manual with the abbreviation ADMIN]

NOTES

swapon to a tmpfs file is not supported. File and record locking is not supported.

df.1v output is of limited accuracy since a tmpfs filesystem size is not static and the space available to tmpfs is dependent on the swap space demands of the entire system.

DIAGNOSTICS

If tmpfs runs out of space, one of the following messages will be printed to the console.

directory: file system full, anon reservation exceeded
directory: file system full, anon allocation exceeded
A page could not be allocated while writing to a file. This can occur if tmpfs is attempting to write more than it is allowed, or if currently executing programs are using a lot of memory. To make more space available, remove unneccessary files, exit from some programs, or allocate more swap space using swapon.8
directory: file system full, kmem_alloc failure
tmpfs ran out of physical memory while attempting to create a new file or directory. Remove unneccesary files or directories or install more physical memory.

WARNINGS

A tmpfs filesystem should not be mounted on /var/tmp, this directory is used by vi.1 for preserved files.

Files and directories on a tmpfs filesystem are not preserved across reboots or unmounts. Command scripts or programs which count on this will not work as expected.


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © by Hans-Peter Bischof. All Rights Reserved (1997).

Last modified 21/April/97