in-memory file system
To compile this driver into the kernel, place the following line in your kernel
Alternatively, to load the driver as a module at boot time, place the following
driver implements an in-memory, or
tmpfs file system. The filesystem stores both file metadata and data in main
memory. This allows very fast and low latency accesses to the data. The data
is volatile. An umount or system reboot invalidates it. These properties make
the filesystem's mounts suitable for fast scratch storage, like
If the system becomes low on memory and swap is configured (see
), the system can transfer file data to swap space, freeing memory for other
needs. Metadata, including the directory content, is never swapped out by the
current implementation. Keep this in mind when planning the mount limits,
especially when expecting to place many small files on a tmpfs mount.
is used on a file from a tmpfs mount, the swap VM object managing the file
pages is used to implement mapping and avoid double-copying of the file data.
This quirk causes process inspection tools, like
to report anonymous memory mappings instead of file mappings.
The following options are available when mounting
- Specifies the group ID of the root inode of the file system. Defaults to
the mount point's GID.
- Specifies the user ID of the root inode of the file system. Defaults to
the mount point's UID.
- Specifies the mode (in octal notation) of the root inode of the file
system. Defaults to the mount point's mode.
- Do not use namecache to resolve names to files for the created mount. This
saves memory, but currently might impair scalability for highly used
mounts on large machines.
- Specifies the maximum number of nodes available to the file system. If not
specified, the file system chooses a reasonable maximum based on the file
system size, which can be limited with the
- Specifies the total file system size in bytes, unless suffixed with one of
k, m, g, t, or p, which denote byte, kilobyte, megabyte, gigabyte,
terabyte and petabyte respectively. If zero (the default) or a value
larger than SIZE_MAX - PAGE_SIZE is given, the available amount of memory
(including main memory and swap space) will be used.
- Specifies the maximum file size in bytes. Defaults to the maximum possible
To mount a
memory file system:
mount -t tmpfs tmpfs
driver first appeared in
kernel implementation was written
by Julio M. Merino Vidal
as a Google Summer of Code project.
and others ported it from
This manual page was written by Xin LI