]>
Commit | Line | Data |
---|---|---|
244b15d4 MK |
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 | .\" | |
734882f4 | 25 | .TH TMPFS 5 2017-05-03 "Linux" "Linux Programmer's Manual" |
244b15d4 MK |
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 | ||
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 | ||
41 | $ sudo mount \-t tmpfs -o size=10M tmpfs /mnt/mytmpfs | |
42 | ||
43 | A | |
44 | .B tmpfs | |
45 | filesystem has the following properties: | |
46 | .IP * 3 | |
47 | The filesystem can employ swap space when physical memory pressure | |
48 | demands it. | |
49 | .IP * | |
50 | The | |
51 | .I size | |
52 | option can be used to specify an upper limit on the size of the filesystem. | |
53 | (The default size is half of the available RAM size.) | |
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 | .SH VERSIONS | |
66 | The | |
67 | .B tmpfs | |
68 | facility was added in Linux 2.4, as a successor to the older | |
69 | .B ramfs | |
70 | facility, which did not provide limit checking or | |
71 | allow for the use of swap space. | |
72 | .SH NOTES | |
73 | For a description of the mount options that may be employed when mounting a | |
74 | .B tmpfs | |
75 | filesystem, see | |
76 | .BR mount (8). | |
77 | ||
765633a2 | 78 | In order for user-space tools and applications to create |
244b15d4 MK |
79 | .B tmpfs |
80 | filesystems, the kernel must be configured with the | |
81 | .B CONFIG_TMPFS | |
82 | option. | |
83 | ||
0d8f84db MK |
84 | The |
85 | .BR tmpfs | |
86 | filesystem supports extended attributes (see | |
87 | .BR xattr (7)), | |
88 | but | |
89 | .I user | |
90 | extended attributes are not permitted. | |
91 | ||
244b15d4 MK |
92 | An internal shared memory filesystem is used for |
93 | System V shared memory | |
690e8267 | 94 | .RB ( shmget (2)) |
244b15d4 MK |
95 | and shared anonymous mappings |
96 | .RB ( mmap (2) | |
97 | with the | |
98 | .B MAP_SHARED | |
99 | and | |
100 | .BR MAP_ANONYMOUS | |
101 | flags). | |
102 | This filesystem is available regardless of whether | |
103 | the kernel was configured with the | |
104 | .B CONFIG_TMPFS | |
105 | option. | |
106 | ||
107 | A | |
108 | .B tmpfs | |
109 | filesystem mounted at | |
110 | .IR /dev/shm | |
111 | as used for the implementation of POSIX shared memory | |
112 | .RB ( shm_overview (7)) | |
113 | and POSIX semaphores | |
114 | .RB ( sem_overview (7)). | |
115 | ||
116 | The amount of memory consumed by all | |
117 | .B tmpfs | |
118 | filesystems is shown in the | |
119 | .I Shmem | |
120 | field of | |
121 | .IR /proc/meminfo | |
122 | and in the | |
123 | .I shared | |
124 | field displayed by | |
125 | .BR free (1). | |
126 | ||
127 | The | |
128 | .B tmpfs | |
129 | facility was formerly called | |
130 | .BR shmfs . | |
131 | .SH SEE ALSO | |
132 | .BR df (1), | |
133 | .BR du (1), | |
fe340cde MK |
134 | .BR memfd_create (2), |
135 | .BR mmap (2), | |
136 | .BR shm_open (3), | |
244b15d4 MK |
137 | .BR mount (8) |
138 | .PP | |
139 | The kernel source file | |
140 | .IR Documentation/filesystems/tmpfs.txt . |