]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man5/tmpfs.5
sysfs.5: Refer to cgroups(7) for information about files in /sys/kernel/cgroup
[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
55 .I size
56 option can be used to specify an upper limit on the size of the filesystem.
57 (The default size is half of the available RAM size.)
58 The filesystem consumes only as much physical memory and swap space
59 as is required to store the current contents of the filesystem.
60 .IP *
61 During a remount operation
62 .RI ( "mount\ \-o\ remount" ),
63 the filesystem size can be changed
64 (without losing the existing contents of the filesystem).
65 .PP
66 If a
67 .B tmpfs
68 filesystem is unmounted, its contents are discarded (lost).
69 .SH VERSIONS
70 The
71 .B tmpfs
72 facility was added in Linux 2.4, as a successor to the older
73 .B ramfs
74 facility, which did not provide limit checking or
75 allow for the use of swap space.
76 .SH NOTES
77 For a description of the mount options that may be employed when mounting a
78 .B tmpfs
79 filesystem, see
80 .BR mount (8).
81 .PP
82 In order for user-space tools and applications to create
83 .B tmpfs
84 filesystems, the kernel must be configured with the
85 .B CONFIG_TMPFS
86 option.
87 .PP
88 The
89 .BR tmpfs
90 filesystem supports extended attributes (see
91 .BR xattr (7)),
92 but
93 .I user
94 extended attributes are not permitted.
95 .PP
96 An internal shared memory filesystem is used for
97 System V shared memory
98 .RB ( shmget (2))
99 and shared anonymous mappings
100 .RB ( mmap (2)
101 with the
102 .B MAP_SHARED
103 and
104 .BR MAP_ANONYMOUS
105 flags).
106 This filesystem is available regardless of whether
107 the kernel was configured with the
108 .B CONFIG_TMPFS
109 option.
110 .PP
111 A
112 .B tmpfs
113 filesystem mounted at
114 .IR /dev/shm
115 as used for the implementation of POSIX shared memory
116 .RB ( shm_overview (7))
117 and POSIX semaphores
118 .RB ( sem_overview (7)).
119 .PP
120 The amount of memory consumed by all
121 .B tmpfs
122 filesystems is shown in the
123 .I Shmem
124 field of
125 .IR /proc/meminfo
126 and in the
127 .I shared
128 field displayed by
129 .BR free (1).
130 .PP
131 The
132 .B tmpfs
133 facility was formerly called
134 .BR shmfs .
135 .SH SEE ALSO
136 .BR df (1),
137 .BR du (1),
138 .BR memfd_create (2),
139 .BR mmap (2),
140 .BR shm_open (3),
141 .BR mount (8)
142 .PP
143 The kernel source file
144 .IR Documentation/filesystems/tmpfs.txt .