]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man5/tmpfs.5
tmpfs.5: Reformat 'huge' and 'mpol' mount option values as lists
[thirdparty/man-pages.git] / man5 / tmpfs.5
1 .\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
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.
7 .\"
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.
12 .\"
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
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH TMPFS 5 2017-05-03 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 tmpfs \- a virtual memory filesystem
28 .SH DESCRIPTION
29 The
30 .B tmpfs
31 facility allows the creation of filesystems whose contents reside
32 in virtual memory.
33 Since the files on such filesystems typically reside in RAM,
34 file access is extremely fast.
35 .PP
36 The filesystem is automatically created when mounting
37 a filesystem with the type
38 .BR tmpfs
39 via a command such as the following:
40 .PP
41 .in +4n
42 .EX
43 $ sudo mount \-t tmpfs -o size=10M tmpfs /mnt/mytmpfs
44 .EE
45 .in
46 .PP
47 A
48 .B tmpfs
49 filesystem has the following properties:
50 .IP * 3
51 The filesystem can employ swap space when physical memory pressure
52 demands it.
53 .IP *
54 The filesystem consumes only as much physical memory and swap space
55 as is required to store the current contents of the filesystem.
56 .IP *
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).
61 .PP
62 If a
63 .B tmpfs
64 filesystem is unmounted, its contents are discarded (lost).
65 .\" See mm/shmem.c:shmem_parse_options for options it supports.
66 .SS Mount options
67 The
68 .B tmpfs
69 filesystem supports the following mount options:
70 .TP
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.
74 .IP
75 The size may have a
76 .BR k ,
77 .BR m ,
78 or
79 .B g
80 suffix for Ki, Mi, Gi (binary kilo (kibi), binary mega (mebi) and binary giga
81 (gibi)).
82 .IP
83 The size may also have a % suffix to limit this instance to a percentage of
84 physical RAM.
85 .IP
86 The default, when neither
87 .B size
88 nor
89 .B nr_blocks
90 is specified, is
91 .IR size=50% .
92 .TP
93 .BR nr_blocks "=\fIblocks\fP"
94 The same as
95 .BR size ,
96 but in blocks of
97 .BR PAGE_CACHE_SIZE .
98 .IP
99 Blocks may be specified with
100 .BR k ,
101 .BR m ,
102 or
103 .B g
104 suffixes like
105 .BR size ,
106 but not a % suffix.
107 .TP
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.
112 .IP
113 Inodes may be specified with
114 .BR k ,
115 .BR m ,
116 or
117 .B g
118 suffixes like
119 .BR size ,
120 but not a % suffix.
121 .TP
122 .BR mode "=\fImode\fP"
123 Set initial permissions of the root directory.
124 .TP
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.
129 .TP
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.
134 .TP
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
139 is enabled).
140 .IP
141 The
142 .I huge_option
143 value is one of the following:
144 .RS
145 .TP
146 .B never
147
148 .TP
149 .B always
150
151 .TP
152 .B within_size
153
154 .TP
155 .B advise
156
157 .TP
158 .B deny
159
160 .TP
161 .B force
162
163 .RE
164 .TP
165 .BR mpol "=\fImpol_option\fR (since Linux 2.6.15)"
166 .\" commit 7339ff8302fd70aabf5f1ae26e0c4905fa74a495
167 Set the NUMA memory allocation policy for all files in this instance (if
168 .B CONFIG_NUMA
169 is enabled).
170 .IP
171 The
172 .I mpol_option
173 value is one of the following:
174 .RS
175 .TP
176 .B default
177
178 .TP
179 .BR prefer ":\fINode\fP"
180
181 .TP
182 .BR bind ":\fINodeList\fP"
183
184 .TP
185 .B interleave
186
187 .TP
188 .BR interleave ":\fINodeList\fP"
189
190 .RE
191 .SH VERSIONS
192 The
193 .B tmpfs
194 facility was added in Linux 2.4, as a successor to the older
195 .B ramfs
196 facility, which did not provide limit checking or
197 allow for the use of swap space.
198 .SH NOTES
199 In order for user-space tools and applications to create
200 .B tmpfs
201 filesystems, the kernel must be configured with the
202 .B CONFIG_TMPFS
203 option.
204 .PP
205 The
206 .BR tmpfs
207 filesystem supports extended attributes (see
208 .BR xattr (7)),
209 but
210 .I user
211 extended attributes are not permitted.
212 .PP
213 An internal shared memory filesystem is used for
214 System V shared memory
215 .RB ( shmget (2))
216 and shared anonymous mappings
217 .RB ( mmap (2)
218 with the
219 .B MAP_SHARED
220 and
221 .BR MAP_ANONYMOUS
222 flags).
223 This filesystem is available regardless of whether
224 the kernel was configured with the
225 .B CONFIG_TMPFS
226 option.
227 .PP
228 A
229 .B tmpfs
230 filesystem mounted at
231 .IR /dev/shm
232 as used for the implementation of POSIX shared memory
233 .RB ( shm_overview (7))
234 and POSIX semaphores
235 .RB ( sem_overview (7)).
236 .PP
237 The amount of memory consumed by all
238 .B tmpfs
239 filesystems is shown in the
240 .I Shmem
241 field of
242 .IR /proc/meminfo
243 and in the
244 .I shared
245 field displayed by
246 .BR free (1).
247 .PP
248 The
249 .B tmpfs
250 facility was formerly called
251 .BR shmfs .
252 .SH SEE ALSO
253 .BR df (1),
254 .BR du (1),
255 .BR memfd_create (2),
256 .BR mmap (2),
257 .BR shm_open (3),
258 .BR mount (8)
259 .PP
260 The kernel source file
261 .IR Documentation/filesystems/tmpfs.txt .