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.
|
cpuid.4, fd.4, full.4, initrd.4, lirc.4, msr.4, null.4, vcs.4, charmap.5, core.5, dir_colors.5, filesystems.5, gai.conf.5, hosts.equiv.5, locale.5, motd.5, networks.5, nscd.conf.5, nss.5, proc.5, protocols.5, repertoiremap.5, services.5, tmpfs.5, ttytype.5, intro.8, nscd.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:55 +00:00
|
|
|
.PP
|
2016-11-07 14:44:24 +00:00
|
|
|
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 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).
|
2018-01-27 09:59:28 +00:00
|
|
|
.\" See mm/shmem.c:shmem_parse_options for options it supports.
|
|
|
|
.SS Mount options
|
|
|
|
The
|
|
|
|
.B tmpfs
|
|
|
|
filesystem supports the following mount options:
|
|
|
|
.TP
|
|
|
|
.BR size "=\fIbytes\fP"
|
|
|
|
Specify an upper limit on the size of the filesystem.
|
|
|
|
The size is given in bytes, and rounded up to entire pages.
|
2018-02-03 16:04:35 +00:00
|
|
|
.IP
|
2018-01-27 09:59:28 +00:00
|
|
|
The size may have a
|
|
|
|
.BR k ,
|
|
|
|
.BR m ,
|
|
|
|
or
|
|
|
|
.B g
|
|
|
|
suffix for Ki, Mi, Gi (binary kilo (kibi), binary mega (mebi) and binary giga
|
|
|
|
(gibi)).
|
2018-02-03 16:04:35 +00:00
|
|
|
.IP
|
2018-01-27 09:59:28 +00:00
|
|
|
The size may also have a % suffix to limit this instance to a percentage of
|
|
|
|
physical RAM.
|
2018-02-03 16:04:35 +00:00
|
|
|
.IP
|
|
|
|
The default, when neither
|
|
|
|
.B size
|
|
|
|
nor
|
|
|
|
.B nr_blocks
|
|
|
|
is specified, is
|
|
|
|
.IR size=50% .
|
2018-01-27 09:59:28 +00:00
|
|
|
.TP
|
|
|
|
.BR nr_blocks "=\fIblocks\fP"
|
|
|
|
The same as
|
|
|
|
.BR size ,
|
2018-02-03 16:04:35 +00:00
|
|
|
but in blocks of
|
|
|
|
.BR PAGE_CACHE_SIZE .
|
|
|
|
.IP
|
2018-01-27 09:59:28 +00:00
|
|
|
Blocks may be specified with
|
|
|
|
.BR k ,
|
|
|
|
.BR m ,
|
|
|
|
or
|
|
|
|
.B g
|
|
|
|
suffixes like
|
|
|
|
.BR size ,
|
|
|
|
but not a % suffix.
|
|
|
|
.TP
|
|
|
|
.BR nr_inodes "=\fIinodes\fP"
|
|
|
|
The maximum number of inodes for this instance.
|
|
|
|
The default is half of the number of your physical RAM pages, or (on a
|
|
|
|
machine with highmem) the number of lowmem RAM pages, whichever is smaller.
|
2018-02-03 16:04:35 +00:00
|
|
|
.IP
|
2018-01-27 09:59:28 +00:00
|
|
|
Inodes may be specified with
|
|
|
|
.BR k ,
|
|
|
|
.BR m ,
|
|
|
|
or
|
|
|
|
.B g
|
|
|
|
suffixes like
|
|
|
|
.BR size ,
|
|
|
|
but not a % suffix.
|
|
|
|
.TP
|
|
|
|
.BR mode "=\fImode\fP"
|
|
|
|
Set initial permissions of the root directory.
|
|
|
|
.TP
|
|
|
|
.BR gid "=\fIgid\fP (since Linux 2.5.7)"
|
|
|
|
.\" Technically this is also in some version of Linux 2.4.
|
|
|
|
.\" commit 099445b489625b80b1d6687c9b6072dbeaca4096
|
|
|
|
Set the initial group ID of the root directory.
|
|
|
|
.TP
|
|
|
|
.BR uid "=\fIuid\fP (since Linux 2.5.7)"
|
|
|
|
.\" Technically this is also in some version of Linux 2.4.
|
|
|
|
.\" commit 099445b489625b80b1d6687c9b6072dbeaca4096
|
|
|
|
Set the initial user ID of the root directory.
|
|
|
|
.TP
|
2018-02-04 07:42:09 +00:00
|
|
|
.BR huge "=\fIhuge_option\fR (since Linux 4.7.0)"
|
2018-01-27 09:59:28 +00:00
|
|
|
.\" commit 5a6e75f8110c97e2a5488894d4e922187e6cb343
|
|
|
|
Set the huge table memory allocation policy for all files in this instance (if
|
2018-02-03 16:04:35 +00:00
|
|
|
.B CONFIG_TRANSPARENT_HUGE_PAGECACHE
|
|
|
|
is enabled).
|
2018-02-04 07:42:09 +00:00
|
|
|
.IP
|
|
|
|
The
|
|
|
|
.I huge_option
|
|
|
|
value is one of the following:
|
|
|
|
.RS
|
|
|
|
.TP
|
|
|
|
.B never
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B always
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B within_size
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B advise
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B deny
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B force
|
|
|
|
|
|
|
|
.RE
|
2018-01-27 09:59:28 +00:00
|
|
|
.TP
|
2018-02-04 07:42:09 +00:00
|
|
|
.BR mpol "=\fImpol_option\fR (since Linux 2.6.15)"
|
2018-01-27 09:59:28 +00:00
|
|
|
.\" commit 7339ff8302fd70aabf5f1ae26e0c4905fa74a495
|
|
|
|
Set the NUMA memory allocation policy for all files in this instance (if
|
2018-02-03 16:04:35 +00:00
|
|
|
.B CONFIG_NUMA
|
|
|
|
is enabled).
|
2018-02-04 07:42:09 +00:00
|
|
|
.IP
|
|
|
|
The
|
|
|
|
.I mpol_option
|
|
|
|
value is one of the following:
|
|
|
|
.RS
|
|
|
|
.TP
|
|
|
|
.B default
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.BR prefer ":\fINode\fP"
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.BR bind ":\fINodeList\fP"
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.B interleave
|
|
|
|
|
|
|
|
.TP
|
|
|
|
.BR interleave ":\fINodeList\fP"
|
|
|
|
|
|
|
|
.RE
|
2016-11-07 14:44:24 +00:00
|
|
|
.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
|
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.
|
cpuid.4, fd.4, full.4, initrd.4, lirc.4, msr.4, null.4, vcs.4, charmap.5, core.5, dir_colors.5, filesystems.5, gai.conf.5, hosts.equiv.5, locale.5, motd.5, networks.5, nscd.conf.5, nss.5, proc.5, protocols.5, repertoiremap.5, services.5, tmpfs.5, ttytype.5, intro.8, nscd.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:55 +00:00
|
|
|
.PP
|
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.
|
cpuid.4, fd.4, full.4, initrd.4, lirc.4, msr.4, null.4, vcs.4, charmap.5, core.5, dir_colors.5, filesystems.5, gai.conf.5, hosts.equiv.5, locale.5, motd.5, networks.5, nscd.conf.5, nss.5, proc.5, protocols.5, repertoiremap.5, services.5, tmpfs.5, ttytype.5, intro.8, nscd.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:55 +00:00
|
|
|
.PP
|
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.
|
cpuid.4, fd.4, full.4, initrd.4, lirc.4, msr.4, null.4, vcs.4, charmap.5, core.5, dir_colors.5, filesystems.5, gai.conf.5, hosts.equiv.5, locale.5, motd.5, networks.5, nscd.conf.5, nss.5, proc.5, protocols.5, repertoiremap.5, services.5, tmpfs.5, ttytype.5, intro.8, nscd.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:55 +00:00
|
|
|
.PP
|
2016-11-07 14:44:24 +00:00
|
|
|
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)).
|
cpuid.4, fd.4, full.4, initrd.4, lirc.4, msr.4, null.4, vcs.4, charmap.5, core.5, dir_colors.5, filesystems.5, gai.conf.5, hosts.equiv.5, locale.5, motd.5, networks.5, nscd.conf.5, nss.5, proc.5, protocols.5, repertoiremap.5, services.5, tmpfs.5, ttytype.5, intro.8, nscd.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:55 +00:00
|
|
|
.PP
|
2016-11-07 14:44:24 +00:00
|
|
|
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).
|
cpuid.4, fd.4, full.4, initrd.4, lirc.4, msr.4, null.4, vcs.4, charmap.5, core.5, dir_colors.5, filesystems.5, gai.conf.5, hosts.equiv.5, locale.5, motd.5, networks.5, nscd.conf.5, nss.5, proc.5, protocols.5, repertoiremap.5, services.5, tmpfs.5, ttytype.5, intro.8, nscd.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-17 22:59:55 +00:00
|
|
|
.PP
|
2016-11-07 14:44:24 +00:00
|
|
|
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 .
|