1 .\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH TMPFS 5 2021-03-22 "Linux" "Linux Programmer's Manual"
27 tmpfs \- a virtual memory filesystem
31 facility allows the creation of filesystems whose contents reside
33 Since the files on such filesystems typically reside in RAM,
34 file access is extremely fast.
36 The filesystem is automatically created when mounting
37 a filesystem with the type
39 via a command such as the following:
43 $ sudo mount \-t tmpfs \-o size=10M tmpfs /mnt/mytmpfs
49 filesystem has the following properties:
51 The filesystem can employ swap space when physical memory pressure
54 The filesystem consumes only as much physical memory and swap space
55 as is required to store the current contents of the filesystem.
57 During a remount operation
58 .RI ( "mount\ \-o\ remount" ),
59 the filesystem size can be changed
60 (without losing the existing contents of the filesystem).
64 filesystem is unmounted, its contents are discarded (lost).
65 .\" See mm/shmem.c:shmem_parse_options for options it supports.
69 filesystem supports the following mount options:
71 .BR size "=\fIbytes\fP"
72 Specify an upper limit on the size of the filesystem.
73 The size is given in bytes, and rounded up to entire pages.
80 suffix for Ki, Mi, Gi (binary kilo (kibi), binary mega (mebi), and binary giga
83 The size may also have a % suffix to limit this instance to a percentage of
86 The default, when neither
93 .BR nr_blocks "=\fIblocks\fP"
99 Blocks may be specified with
108 .BR nr_inodes "=\fIinodes\fP"
109 The maximum number of inodes for this instance.
110 The default is half of the number of your physical RAM pages, or (on a
111 machine with highmem) the number of lowmem RAM pages, whichever is smaller.
113 Inodes may be specified with
122 .BR mode "=\fImode\fP"
123 Set initial permissions of the root directory.
125 .BR gid "=\fIgid\fP (since Linux 2.5.7)"
126 .\" Technically this is also in some version of Linux 2.4.
127 .\" commit 099445b489625b80b1d6687c9b6072dbeaca4096
128 Set the initial group ID of the root directory.
130 .BR uid "=\fIuid\fP (since Linux 2.5.7)"
131 .\" Technically this is also in some version of Linux 2.4.
132 .\" commit 099445b489625b80b1d6687c9b6072dbeaca4096
133 Set the initial user ID of the root directory.
135 .BR huge "=\fIhuge_option\fR (since Linux 4.7.0)"
136 .\" commit 5a6e75f8110c97e2a5488894d4e922187e6cb343
137 Set the huge table memory allocation policy for all files in this instance (if
138 .B CONFIG_TRANSPARENT_HUGE_PAGECACHE
143 value is one of the following:
147 Do not allocate huge pages.
151 Attempt to allocate huge pages every time a new page is needed.
154 Only allocate huge page if it will be fully within
157 .BR fadvise (2)/ madvise (2)
161 Only allocate huge pages if requested with
162 .BR fadvise (2)/ madvise (2).
165 For use in emergencies, to force the huge option off from all mounts.
168 Force the huge option on for all mounts; useful for testing.
171 .BR mpol "=\fImpol_option\fR (since Linux 2.6.15)"
172 .\" commit 7339ff8302fd70aabf5f1ae26e0c4905fa74a495
173 Set the NUMA memory allocation policy for all files in this instance (if
179 value is one of the following:
183 Use the process allocation policy (see
184 .BR set_mempolicy (2)).
186 .BR prefer ":\fInode\fP"
187 Preferably allocate memory from the given
190 .BR bind ":\fInodelist\fP"
191 Allocate memory only from nodes in
195 Allocate from each node in turn.
197 .BR interleave ":\fInodelist\fP"
198 Allocate from each node of
203 Preferably allocate memory from the local node.
208 is a comma-separated list of decimal numbers and ranges
209 that specify NUMA nodes.
210 A range is a pair of hyphen-separated decimal numbers,
211 the smallest and largest node numbers in the range.
213 .IR mpol=bind:0\-3,5,7,9\-15 .
217 facility was added in Linux 2.4, as a successor to the older
219 facility, which did not provide limit checking or
220 allow for the use of swap space.
222 In order for user-space tools and applications to create
224 filesystems, the kernel must be configured with the
230 filesystem supports extended attributes (see
234 extended attributes are not permitted.
236 An internal shared memory filesystem is used for
237 System V shared memory
239 and shared anonymous mappings
246 This filesystem is available regardless of whether
247 the kernel was configured with the
253 filesystem mounted at
255 is used for the implementation of POSIX shared memory
256 .RB ( shm_overview (7))
258 .RB ( sem_overview (7)).
260 The amount of memory consumed by all
262 filesystems is shown in the
273 facility was formerly called
278 .BR memfd_create (2),
280 .BR set_mempolicy (2),
284 The kernel source files
285 .IR Documentation/filesystems/tmpfs.txt
287 .IR Documentation/admin\-guide/mm/transhuge.rst .