]>
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 | .\" | |
25 | .TH TMPFS 5 2016-11-07 "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 | ||
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 | ||
78 | In order to for user-space tools and applications to create | |
79 | .B tmpfs | |
80 | filesystems, the kernel must be configured with the | |
81 | .B CONFIG_TMPFS | |
82 | option. | |
83 | ||
84 | An internal shared memory filesystem is used for | |
85 | System V shared memory | |
86 | .BR (shmget (2)) | |
87 | and shared anonymous mappings | |
88 | .RB ( mmap (2) | |
89 | with the | |
90 | .B MAP_SHARED | |
91 | and | |
92 | .BR MAP_ANONYMOUS | |
93 | flags). | |
94 | This filesystem is available regardless of whether | |
95 | the kernel was configured with the | |
96 | .B CONFIG_TMPFS | |
97 | option. | |
98 | ||
99 | A | |
100 | .B tmpfs | |
101 | filesystem mounted at | |
102 | .IR /dev/shm | |
103 | as used for the implementation of POSIX shared memory | |
104 | .RB ( shm_overview (7)) | |
105 | and POSIX semaphores | |
106 | .RB ( sem_overview (7)). | |
107 | ||
108 | The amount of memory consumed by all | |
109 | .B tmpfs | |
110 | filesystems is shown in the | |
111 | .I Shmem | |
112 | field of | |
113 | .IR /proc/meminfo | |
114 | and in the | |
115 | .I shared | |
116 | field displayed by | |
117 | .BR free (1). | |
118 | ||
119 | The | |
120 | .B tmpfs | |
121 | facility was formerly called | |
122 | .BR shmfs . | |
123 | .SH SEE ALSO | |
124 | .BR df (1), | |
125 | .BR du (1), | |
126 | .BR mount (8) | |
127 | .PP | |
128 | The kernel source file | |
129 | .IR Documentation/filesystems/tmpfs.txt . |