|
Packit |
7cfc04 |
.\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com>
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_START(VERBATIM)
|
|
Packit |
7cfc04 |
.\" Permission is granted to make and distribute verbatim copies of this
|
|
Packit |
7cfc04 |
.\" manual provided the copyright notice and this permission notice are
|
|
Packit |
7cfc04 |
.\" preserved on all copies.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Permission is granted to copy and distribute modified versions of this
|
|
Packit |
7cfc04 |
.\" manual under the conditions for verbatim copying, provided that the
|
|
Packit |
7cfc04 |
.\" entire resulting derived work is distributed under the terms of a
|
|
Packit |
7cfc04 |
.\" permission notice identical to this one.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
Packit |
7cfc04 |
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
Packit |
7cfc04 |
.\" responsibility for errors or omissions, or for damages resulting from
|
|
Packit |
7cfc04 |
.\" the use of the information contained herein. The author(s) may not
|
|
Packit |
7cfc04 |
.\" have taken the same level of care in the production of this manual,
|
|
Packit |
7cfc04 |
.\" which is licensed free of charge, as they might when working
|
|
Packit |
7cfc04 |
.\" professionally.
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
Packit |
7cfc04 |
.\" the source, must acknowledge the copyright and authors of this work.
|
|
Packit |
7cfc04 |
.\" %%%LICENSE_END
|
|
Packit |
7cfc04 |
.\"
|
|
Packit |
7cfc04 |
.TH TMPFS 5 2017-05-03 "Linux" "Linux Programmer's Manual"
|
|
Packit |
7cfc04 |
.SH NAME
|
|
Packit |
7cfc04 |
tmpfs \- a virtual memory filesystem
|
|
Packit |
7cfc04 |
.SH DESCRIPTION
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.B tmpfs
|
|
Packit |
7cfc04 |
facility allows the creation of filesystems whose contents reside
|
|
Packit |
7cfc04 |
in virtual memory.
|
|
Packit |
7cfc04 |
Since the files on such filesystems typically reside in RAM,
|
|
Packit |
7cfc04 |
file access is extremely fast.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The filesystem is automatically created when mounting
|
|
Packit |
7cfc04 |
a filesystem with the type
|
|
Packit |
7cfc04 |
.BR tmpfs
|
|
Packit |
7cfc04 |
via a command such as the following:
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
.in +4n
|
|
Packit |
7cfc04 |
.EX
|
|
Packit |
7cfc04 |
$ sudo mount \-t tmpfs -o size=10M tmpfs /mnt/mytmpfs
|
|
Packit |
7cfc04 |
.EE
|
|
Packit |
7cfc04 |
.in
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
A
|
|
Packit |
7cfc04 |
.B tmpfs
|
|
Packit |
7cfc04 |
filesystem has the following properties:
|
|
Packit |
7cfc04 |
.IP * 3
|
|
Packit |
7cfc04 |
The filesystem can employ swap space when physical memory pressure
|
|
Packit |
7cfc04 |
demands it.
|
|
Packit |
7cfc04 |
.IP *
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.I size
|
|
Packit |
7cfc04 |
option can be used to specify an upper limit on the size of the filesystem.
|
|
Packit |
7cfc04 |
(The default size is half of the available RAM size.)
|
|
Packit |
7cfc04 |
The filesystem consumes only as much physical memory and swap space
|
|
Packit |
7cfc04 |
as is required to store the current contents of the filesystem.
|
|
Packit |
7cfc04 |
.IP *
|
|
Packit |
7cfc04 |
During a remount operation
|
|
Packit |
7cfc04 |
.RI ( "mount\ \-o\ remount" ),
|
|
Packit |
7cfc04 |
the filesystem size can be changed
|
|
Packit |
7cfc04 |
(without losing the existing contents of the filesystem).
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
If a
|
|
Packit |
7cfc04 |
.B tmpfs
|
|
Packit |
7cfc04 |
filesystem is unmounted, its contents are discarded (lost).
|
|
Packit |
7cfc04 |
.SH VERSIONS
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.B tmpfs
|
|
Packit |
7cfc04 |
facility was added in Linux 2.4, as a successor to the older
|
|
Packit |
7cfc04 |
.B ramfs
|
|
Packit |
7cfc04 |
facility, which did not provide limit checking or
|
|
Packit |
7cfc04 |
allow for the use of swap space.
|
|
Packit |
7cfc04 |
.SH NOTES
|
|
Packit |
7cfc04 |
For a description of the mount options that may be employed when mounting a
|
|
Packit |
7cfc04 |
.B tmpfs
|
|
Packit |
7cfc04 |
filesystem, see
|
|
Packit |
7cfc04 |
.BR mount (8).
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
In order for user-space tools and applications to create
|
|
Packit |
7cfc04 |
.B tmpfs
|
|
Packit |
7cfc04 |
filesystems, the kernel must be configured with the
|
|
Packit |
7cfc04 |
.B CONFIG_TMPFS
|
|
Packit |
7cfc04 |
option.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.BR tmpfs
|
|
Packit |
7cfc04 |
filesystem supports extended attributes (see
|
|
Packit |
7cfc04 |
.BR xattr (7)),
|
|
Packit |
7cfc04 |
but
|
|
Packit |
7cfc04 |
.I user
|
|
Packit |
7cfc04 |
extended attributes are not permitted.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
An internal shared memory filesystem is used for
|
|
Packit |
7cfc04 |
System V shared memory
|
|
Packit |
7cfc04 |
.RB ( shmget (2))
|
|
Packit |
7cfc04 |
and shared anonymous mappings
|
|
Packit |
7cfc04 |
.RB ( mmap (2)
|
|
Packit |
7cfc04 |
with the
|
|
Packit |
7cfc04 |
.B MAP_SHARED
|
|
Packit |
7cfc04 |
and
|
|
Packit |
7cfc04 |
.BR MAP_ANONYMOUS
|
|
Packit |
7cfc04 |
flags).
|
|
Packit |
7cfc04 |
This filesystem is available regardless of whether
|
|
Packit |
7cfc04 |
the kernel was configured with the
|
|
Packit |
7cfc04 |
.B CONFIG_TMPFS
|
|
Packit |
7cfc04 |
option.
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
A
|
|
Packit |
7cfc04 |
.B tmpfs
|
|
Packit |
7cfc04 |
filesystem mounted at
|
|
Packit |
7cfc04 |
.IR /dev/shm
|
|
Packit |
7cfc04 |
as used for the implementation of POSIX shared memory
|
|
Packit |
7cfc04 |
.RB ( shm_overview (7))
|
|
Packit |
7cfc04 |
and POSIX semaphores
|
|
Packit |
7cfc04 |
.RB ( sem_overview (7)).
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The amount of memory consumed by all
|
|
Packit |
7cfc04 |
.B tmpfs
|
|
Packit |
7cfc04 |
filesystems is shown in the
|
|
Packit |
7cfc04 |
.I Shmem
|
|
Packit |
7cfc04 |
field of
|
|
Packit |
7cfc04 |
.IR /proc/meminfo
|
|
Packit |
7cfc04 |
and in the
|
|
Packit |
7cfc04 |
.I shared
|
|
Packit |
7cfc04 |
field displayed by
|
|
Packit |
7cfc04 |
.BR free (1).
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The
|
|
Packit |
7cfc04 |
.B tmpfs
|
|
Packit |
7cfc04 |
facility was formerly called
|
|
Packit |
7cfc04 |
.BR shmfs .
|
|
Packit |
7cfc04 |
.SH SEE ALSO
|
|
Packit |
7cfc04 |
.BR df (1),
|
|
Packit |
7cfc04 |
.BR du (1),
|
|
Packit |
7cfc04 |
.BR memfd_create (2),
|
|
Packit |
7cfc04 |
.BR mmap (2),
|
|
Packit |
7cfc04 |
.BR shm_open (3),
|
|
Packit |
7cfc04 |
.BR mount (8)
|
|
Packit |
7cfc04 |
.PP
|
|
Packit |
7cfc04 |
The kernel source file
|
|
Packit |
7cfc04 |
.IR Documentation/filesystems/tmpfs.txt .
|
|
Packit |
7cfc04 |
.SH COLOPHON
|
|
Packit |
7cfc04 |
This page is part of release 4.15 of the Linux
|
|
Packit |
7cfc04 |
.I man-pages
|
|
Packit |
7cfc04 |
project.
|
|
Packit |
7cfc04 |
A description of the project,
|
|
Packit |
7cfc04 |
information about reporting bugs,
|
|
Packit |
7cfc04 |
and the latest version of this page,
|
|
Packit |
7cfc04 |
can be found at
|
|
Packit |
7cfc04 |
\%https://www.kernel.org/doc/man\-pages/.
|