2016-11-07 14:44:24 +00:00
|
|
|
.\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com>
|
|
|
|
.\"
|
|
|
|
.\" %%%LICENSE_START(VERBATIM)
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
|
|
|
.\"
|
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
|
|
|
.\"
|
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\" %%%LICENSE_END
|
|
|
|
.\"
|
_exit.2, alarm.2, chmod.2, clone.2, epoll_ctl.2, fcntl.2, fork.2, fsync.2, getdents.2, getpid.2, ioctl.2, ioctl_console.2, ioctl_list.2, ioctl_ns.2, ioctl_tty.2, ioctl_userfaultfd.2, kexec_load.2, lseek.2, mincore.2, mkdir.2, mknod.2, mmap.2, open.2, poll.2, posix_fadvise.2, prctl.2, rename.2, sched_setaffinity.2, select.2, select_tut.2, sigaction.2, signalfd.2, sigprocmask.2, sigwaitinfo.2, socketcall.2, stat.2, statx.2, syscalls.2, truncate.2, umask.2, unshare.2, userfaultfd.2, utime.2, utimensat.2, wait.2, bzero.3, cfree.3, exit.3, getentropy.3, grantpt.3, insque.3, shm_open.3, syslog.3, termios.3, ttyname.3, wcsdup.3, console_codes.4, tty.4, vcs.4, elf.5, nsswitch.conf.5, proc.5, slabinfo.5, tmpfs.5, bootparam.7, environ.7, hostname.7, inotify.7, mailaddr.7, man-pages.7, namespaces.7, pid_namespaces.7, pthreads.7, pty.7, sem_overview.7, signal.7, socket.7, tcp.7, termio.7, user_namespaces.7, xattr.7, ld.so.8, zdump.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-05-03 17:27:48 +00:00
|
|
|
.TH TMPFS 5 2017-05-03 "Linux" "Linux Programmer's Manual"
|
2016-11-07 14:44:24 +00:00
|
|
|
.SH NAME
|
|
|
|
tmpfs \- a virtual memory filesystem
|
|
|
|
.SH DESCRIPTION
|
|
|
|
The
|
|
|
|
.B tmpfs
|
|
|
|
facility allows the creation of filesystems whose contents reside
|
|
|
|
in virtual memory.
|
|
|
|
Since the files on such filesystems typically reside in RAM,
|
|
|
|
file access is extremely fast.
|
|
|
|
|
|
|
|
The filesystem is automatically created when mounting
|
|
|
|
a filesystem with the type
|
|
|
|
.BR tmpfs
|
|
|
|
via a command such as the following:
|
2017-08-15 14:15:21 +00:00
|
|
|
.PP
|
|
|
|
.in +4n
|
|
|
|
.EX
|
|
|
|
$ sudo mount \-t tmpfs -o size=10M tmpfs /mnt/mytmpfs
|
|
|
|
.EE
|
|
|
|
.in
|
|
|
|
.PP
|
2016-11-07 14:44:24 +00:00
|
|
|
A
|
|
|
|
.B tmpfs
|
|
|
|
filesystem has the following properties:
|
|
|
|
.IP * 3
|
|
|
|
The filesystem can employ swap space when physical memory pressure
|
|
|
|
demands it.
|
|
|
|
.IP *
|
|
|
|
The
|
|
|
|
.I size
|
|
|
|
option can be used to specify an upper limit on the size of the filesystem.
|
|
|
|
(The default size is half of the available RAM size.)
|
|
|
|
The filesystem consumes only as much physical memory and swap space
|
|
|
|
as is required to store the current contents of the filesystem.
|
|
|
|
.IP *
|
|
|
|
During a remount operation
|
|
|
|
.RI ( "mount\ \-o\ remount" ),
|
|
|
|
the filesystem size can be changed
|
|
|
|
(without losing the existing contents of the filesystem).
|
|
|
|
.PP
|
|
|
|
If a
|
|
|
|
.B tmpfs
|
|
|
|
filesystem is unmounted, its contents are discarded (lost).
|
|
|
|
.SH VERSIONS
|
|
|
|
The
|
|
|
|
.B tmpfs
|
|
|
|
facility was added in Linux 2.4, as a successor to the older
|
|
|
|
.B ramfs
|
|
|
|
facility, which did not provide limit checking or
|
|
|
|
allow for the use of swap space.
|
|
|
|
.SH NOTES
|
|
|
|
For a description of the mount options that may be employed when mounting a
|
|
|
|
.B tmpfs
|
|
|
|
filesystem, see
|
|
|
|
.BR mount (8).
|
|
|
|
|
2017-03-30 15:29:41 +00:00
|
|
|
In order for user-space tools and applications to create
|
2016-11-07 14:44:24 +00:00
|
|
|
.B tmpfs
|
|
|
|
filesystems, the kernel must be configured with the
|
|
|
|
.B CONFIG_TMPFS
|
|
|
|
option.
|
|
|
|
|
2017-03-17 18:41:16 +00:00
|
|
|
The
|
|
|
|
.BR tmpfs
|
|
|
|
filesystem supports extended attributes (see
|
|
|
|
.BR xattr (7)),
|
|
|
|
but
|
|
|
|
.I user
|
|
|
|
extended attributes are not permitted.
|
|
|
|
|
2016-11-07 14:44:24 +00:00
|
|
|
An internal shared memory filesystem is used for
|
|
|
|
System V shared memory
|
2017-07-04 23:02:01 +00:00
|
|
|
.RB ( shmget (2))
|
2016-11-07 14:44:24 +00:00
|
|
|
and shared anonymous mappings
|
|
|
|
.RB ( mmap (2)
|
|
|
|
with the
|
|
|
|
.B MAP_SHARED
|
|
|
|
and
|
|
|
|
.BR MAP_ANONYMOUS
|
|
|
|
flags).
|
|
|
|
This filesystem is available regardless of whether
|
|
|
|
the kernel was configured with the
|
|
|
|
.B CONFIG_TMPFS
|
|
|
|
option.
|
|
|
|
|
|
|
|
A
|
|
|
|
.B tmpfs
|
|
|
|
filesystem mounted at
|
|
|
|
.IR /dev/shm
|
|
|
|
as used for the implementation of POSIX shared memory
|
|
|
|
.RB ( shm_overview (7))
|
|
|
|
and POSIX semaphores
|
|
|
|
.RB ( sem_overview (7)).
|
|
|
|
|
|
|
|
The amount of memory consumed by all
|
|
|
|
.B tmpfs
|
|
|
|
filesystems is shown in the
|
|
|
|
.I Shmem
|
|
|
|
field of
|
|
|
|
.IR /proc/meminfo
|
|
|
|
and in the
|
|
|
|
.I shared
|
|
|
|
field displayed by
|
|
|
|
.BR free (1).
|
|
|
|
|
|
|
|
The
|
|
|
|
.B tmpfs
|
|
|
|
facility was formerly called
|
|
|
|
.BR shmfs .
|
|
|
|
.SH SEE ALSO
|
|
|
|
.BR df (1),
|
|
|
|
.BR du (1),
|
2017-05-26 12:38:55 +00:00
|
|
|
.BR memfd_create (2),
|
|
|
|
.BR mmap (2),
|
|
|
|
.BR shm_open (3),
|
2016-11-07 14:44:24 +00:00
|
|
|
.BR mount (8)
|
|
|
|
.PP
|
|
|
|
The kernel source file
|
|
|
|
.IR Documentation/filesystems/tmpfs.txt .
|