]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man5/tmpfs.5
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man5 / tmpfs.5
CommitLineData
244b15d4
MK
1.\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com>
2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
244b15d4 4.\"
45186a5d 5.TH TMPFS 5 2021-03-22 "Linux man-pages (unreleased)"
244b15d4
MK
6.SH NAME
7tmpfs \- a virtual memory filesystem
8.SH DESCRIPTION
9The
10.B tmpfs
11facility allows the creation of filesystems whose contents reside
12in virtual memory.
13Since the files on such filesystems typically reside in RAM,
14file access is extremely fast.
2dad4c59 15.PP
244b15d4
MK
16The filesystem is automatically created when mounting
17a filesystem with the type
1ae6b2c7 18.B tmpfs
244b15d4 19via a command such as the following:
019d9ee8
MK
20.PP
21.in +4n
22.EX
1c8ae9fe 23$ sudo mount \-t tmpfs \-o size=10M tmpfs /mnt/mytmpfs
019d9ee8
MK
24.EE
25.in
26.PP
244b15d4
MK
27A
28.B tmpfs
29filesystem has the following properties:
30.IP * 3
31The filesystem can employ swap space when physical memory pressure
32demands it.
33.IP *
244b15d4
MK
34The filesystem consumes only as much physical memory and swap space
35as is required to store the current contents of the filesystem.
36.IP *
37During a remount operation
38.RI ( "mount\ \-o\ remount" ),
39the filesystem size can be changed
40(without losing the existing contents of the filesystem).
41.PP
42If a
43.B tmpfs
44filesystem is unmounted, its contents are discarded (lost).
462a385e
CG
45.\" See mm/shmem.c:shmem_parse_options for options it supports.
46.SS Mount options
47The
48.B tmpfs
49filesystem supports the following mount options:
50.TP
51.BR size "=\fIbytes\fP"
52Specify an upper limit on the size of the filesystem.
53The size is given in bytes, and rounded up to entire pages.
d745d283 54.IP
462a385e
CG
55The size may have a
56.BR k ,
57.BR m ,
58or
59.B g
3ded684c 60suffix for Ki, Mi, Gi (binary kilo (kibi), binary mega (mebi), and binary giga
462a385e 61(gibi)).
d745d283 62.IP
462a385e
CG
63The size may also have a % suffix to limit this instance to a percentage of
64physical RAM.
d745d283
MK
65.IP
66The default, when neither
67.B size
68nor
69.B nr_blocks
70is specified, is
71.IR size=50% .
462a385e
CG
72.TP
73.BR nr_blocks "=\fIblocks\fP"
74The same as
75.BR size ,
d745d283
MK
76but in blocks of
77.BR PAGE_CACHE_SIZE .
78.IP
462a385e
CG
79Blocks may be specified with
80.BR k ,
81.BR m ,
82or
83.B g
84suffixes like
85.BR size ,
86but not a % suffix.
87.TP
88.BR nr_inodes "=\fIinodes\fP"
89The maximum number of inodes for this instance.
90The default is half of the number of your physical RAM pages, or (on a
91machine with highmem) the number of lowmem RAM pages, whichever is smaller.
d745d283 92.IP
462a385e
CG
93Inodes may be specified with
94.BR k ,
95.BR m ,
96or
97.B g
98suffixes like
99.BR size ,
100but not a % suffix.
101.TP
102.BR mode "=\fImode\fP"
103Set initial permissions of the root directory.
104.TP
105.BR gid "=\fIgid\fP (since Linux 2.5.7)"
106.\" Technically this is also in some version of Linux 2.4.
107.\" commit 099445b489625b80b1d6687c9b6072dbeaca4096
108Set the initial group ID of the root directory.
109.TP
110.BR uid "=\fIuid\fP (since Linux 2.5.7)"
111.\" Technically this is also in some version of Linux 2.4.
112.\" commit 099445b489625b80b1d6687c9b6072dbeaca4096
113Set the initial user ID of the root directory.
114.TP
a9e25912 115.BR huge "=\fIhuge_option\fR (since Linux 4.7.0)"
462a385e
CG
116.\" commit 5a6e75f8110c97e2a5488894d4e922187e6cb343
117Set the huge table memory allocation policy for all files in this instance (if
d745d283
MK
118.B CONFIG_TRANSPARENT_HUGE_PAGECACHE
119is enabled).
a9e25912
MK
120.IP
121The
122.I huge_option
123value is one of the following:
124.RS
125.TP
126.B never
b230d246
MK
127Do not allocate huge pages.
128This is the default.
a9e25912
MK
129.TP
130.B always
b230d246 131Attempt to allocate huge pages every time a new page is needed.
a9e25912
MK
132.TP
133.B within_size
b230d246
MK
134Only allocate huge page if it will be fully within
135.IR i_size .
136Also respect
137.BR fadvise (2)/ madvise (2)
138hints
a9e25912
MK
139.TP
140.B advise
b230d246
MK
141Only allocate huge pages if requested with
142.BR fadvise (2)/ madvise (2).
a9e25912
MK
143.TP
144.B deny
b230d246 145For use in emergencies, to force the huge option off from all mounts.
a9e25912
MK
146.TP
147.B force
b230d246 148Force the huge option on for all mounts; useful for testing.
a9e25912 149.RE
462a385e 150.TP
a9e25912 151.BR mpol "=\fImpol_option\fR (since Linux 2.6.15)"
462a385e
CG
152.\" commit 7339ff8302fd70aabf5f1ae26e0c4905fa74a495
153Set the NUMA memory allocation policy for all files in this instance (if
d745d283
MK
154.B CONFIG_NUMA
155is enabled).
a9e25912
MK
156.IP
157The
158.I mpol_option
159value is one of the following:
160.RS
161.TP
162.B default
ac02e57c
MK
163Use the process allocation policy (see
164.BR set_mempolicy (2)).
a9e25912 165.TP
ac02e57c
MK
166.BR prefer ":\fInode\fP"
167Preferably allocate memory from the given
168.IR node .
a9e25912 169.TP
ac02e57c
MK
170.BR bind ":\fInodelist\fP"
171Allocate memory only from nodes in
172.IR nodelist .
a9e25912
MK
173.TP
174.B interleave
ac02e57c 175Allocate from each node in turn.
a9e25912 176.TP
ac02e57c
MK
177.BR interleave ":\fInodelist\fP"
178Allocate from each node of
179.I in
180turn.
e1211582
MK
181.TP
182.B local
183Preferably allocate memory from the local node.
a9e25912 184.RE
ac02e57c
MK
185.IP
186In the above,
187.I nodelist
188is a comma-separated list of decimal numbers and ranges
189that specify NUMA nodes.
190A range is a pair of hyphen-separated decimal numbers,
191the smallest and largest node numbers in the range.
192For example,
193.IR mpol=bind:0\-3,5,7,9\-15 .
244b15d4
MK
194.SH VERSIONS
195The
196.B tmpfs
197facility was added in Linux 2.4, as a successor to the older
198.B ramfs
199facility, which did not provide limit checking or
200allow for the use of swap space.
201.SH NOTES
765633a2 202In order for user-space tools and applications to create
244b15d4
MK
203.B tmpfs
204filesystems, the kernel must be configured with the
205.B CONFIG_TMPFS
206option.
2dad4c59 207.PP
0d8f84db 208The
1ae6b2c7 209.B tmpfs
0d8f84db
MK
210filesystem supports extended attributes (see
211.BR xattr (7)),
212but
213.I user
214extended attributes are not permitted.
2dad4c59 215.PP
244b15d4
MK
216An internal shared memory filesystem is used for
217System V shared memory
690e8267 218.RB ( shmget (2))
244b15d4
MK
219and shared anonymous mappings
220.RB ( mmap (2)
221with the
222.B MAP_SHARED
223and
1ae6b2c7 224.B MAP_ANONYMOUS
244b15d4
MK
225flags).
226This filesystem is available regardless of whether
227the kernel was configured with the
228.B CONFIG_TMPFS
229option.
2dad4c59 230.PP
244b15d4
MK
231A
232.B tmpfs
233filesystem mounted at
1ae6b2c7 234.I /dev/shm
f2485f5a 235is used for the implementation of POSIX shared memory
244b15d4
MK
236.RB ( shm_overview (7))
237and POSIX semaphores
238.RB ( sem_overview (7)).
2dad4c59 239.PP
244b15d4
MK
240The amount of memory consumed by all
241.B tmpfs
242filesystems is shown in the
243.I Shmem
244field of
1ae6b2c7 245.I /proc/meminfo
244b15d4
MK
246and in the
247.I shared
248field displayed by
249.BR free (1).
2dad4c59 250.PP
244b15d4
MK
251The
252.B tmpfs
253facility was formerly called
254.BR shmfs .
255.SH SEE ALSO
256.BR df (1),
257.BR du (1),
fe340cde
MK
258.BR memfd_create (2),
259.BR mmap (2),
b8847b59 260.BR set_mempolicy (2),
fe340cde 261.BR shm_open (3),
244b15d4
MK
262.BR mount (8)
263.PP
a6fedca9 264The kernel source files
1ae6b2c7 265.I Documentation/filesystems/tmpfs.txt
a6fedca9 266and
b49c2acb 267.IR Documentation/admin\-guide/mm/transhuge.rst .