]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - share/man/man5/tmpfs.5
MFC r315772:
[FreeBSD/stable/10.git] / share / man / man5 / tmpfs.5
1 .\"-
2 .\" Copyright (c) 2007 Xin LI
3 .\" Copyright (c) 2017 The FreeBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\"
6 .\" Part of this documentation was written by
7 .\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
8 .\" from the FreeBSD Foundation.
9 .\"
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
12 .\" are met:
13 .\" 1. Redistributions of source code must retain the above copyright
14 .\"    notice, this list of conditions and the following disclaimer.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\"    notice, this list of conditions and the following disclaimer in the
17 .\"    documentation and/or other materials provided with the distribution.
18 .\"
19 .\" THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 .\"
30 .\"-
31 .\" Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
32 .\" All rights reserved.
33 .\"
34 .\" Redistribution and use in source and binary forms, with or without
35 .\" modification, are permitted provided that the following conditions
36 .\" are met:
37 .\" 1. Redistributions of source code must retain the above copyright
38 .\"    notice, this list of conditions and the following disclaimer.
39 .\" 2. Redistributions in binary form must reproduce the above copyright
40 .\"    notice, this list of conditions and the following disclaimer in the
41 .\"    documentation and/or other materials provided with the distribution.
42 .\"
43 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
44 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
45 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
46 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
47 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
48 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
49 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
50 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
51 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
52 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
53 .\" POSSIBILITY OF SUCH DAMAGE.
54 .\"
55 .\" $FreeBSD$
56 .\"
57 .Dd January 20, 2017
58 .Dt TMPFS 5
59 .Os
60 .Sh NAME
61 .Nm tmpfs
62 .Nd "in-memory file system"
63 .Sh SYNOPSIS
64 To compile this driver into the kernel,
65 place the following line in your
66 kernel configuration file:
67 .Bd -ragged -offset indent
68 .Cd "options TMPFS"
69 .Ed
70 .Pp
71 Alternatively, to load the driver as a
72 module at boot time, place the following line in
73 .Xr loader.conf 5 :
74 .Bd -literal -offset indent
75 tmpfs_load="YES"
76 .Ed
77 .Sh DESCRIPTION
78 The
79 .Nm
80 driver implements an in-memory, or
81 .Tn tmpfs
82 file system.
83 The filesystem stores both file metadata and data in main memory.
84 This allows very fast and low latency accesses to the data.
85 The data is volatile.
86 An umount or system reboot invalidates it.
87 These properties make the filesystem's mounts suitable for fast
88 scratch storage, like
89 .Pa /tmp .
90 .Pp
91 If the system becomes low on memory and swap is configured (see
92 .Xr swapon 8 ),
93 the system can transfer file data to swap space, freeing memory
94 for other needs.
95 Metadata, including the directory content, is never swapped out by the
96 current implementation.
97 Keep this in mind when planning the mount limits, especially when expecting
98 to place many small files on a tmpfs mount.
99 .Pp
100 When
101 .Xr mmap 2
102 is used on a file from a tmpfs mount, the swap VM object managing the
103 file pages is used to implement mapping and avoid double-copying of
104 the file data.
105 This quirk causes process inspection tools, like
106 .Xr procstat 1 ,
107 to report anonymous memory mappings instead of file mappings.
108 .Sh OPTIONS
109 The following options are available when
110 mounting
111 .Nm
112 file systems:
113 .Bl -tag -width "It Cm maxfilesize"
114 .It Cm gid
115 Specifies the group ID of the root inode of the file system.
116 Defaults to the mount point's GID.
117 .It Cm uid
118 Specifies the user ID of the root inode of the file system.
119 Defaults to the mount point's UID.
120 .It Cm mode
121 Specifies the mode (in octal notation) of the root inode of the file system.
122 Defaults to the mount point's mode.
123 .It Cm nonc
124 Do not use namecache to resolve names to files for the created mount.
125 This saves memory, but currently might impair scalability for highly
126 used mounts on large machines.
127 .It Cm inodes
128 Specifies the maximum number of nodes available to the file system.
129 If not specified, the file system chooses a reasonable maximum based on
130 the file system size, which can be limited with the
131 .Cm size
132 option.
133 .It Cm size
134 Specifies the total file system size in bytes.
135 If zero (the default) or a value larger than SIZE_MAX - PAGE_SIZE
136 is given, the available amount of memory (including
137 main memory and swap space) will be used.
138 .It Cm maxfilesize
139 Specifies the maximum file size in bytes.
140 Defaults to the maximum possible value.
141 .El
142 .Sh EXAMPLES
143 To mount a
144 .Nm
145 memory file system:
146 .Pp
147 .Dl "mount -t tmpfs tmpfs /tmp"
148 .Sh SEE ALSO
149 .Xr procstat 1 ,
150 .Xr mmap 2 ,
151 .Xr nmount 2 ,
152 .Xr unmount 2 ,
153 .Xr fstab 5 ,
154 .Xr mdmfs 8 ,
155 .Xr mount 8 ,
156 .Xr swapinfo 8 ,
157 .Xr swapon 8
158 .Sh HISTORY
159 The
160 .Nm
161 driver first appeared in
162 .Fx 7.0 .
163 .Sh AUTHORS
164 .An -nosplit
165 The
166 .Nm
167 kernel implementation was written by
168 .An Julio M. Merino Vidal Aq jmmv@NetBSD.org
169 as a Google Summer of Code project.
170 .Pp
171 .An Rohit Jalan
172 and others ported it from
173 .Nx
174 to
175 .Fx .
176 .Pp
177 This manual page was written by
178 .An Xin LI Aq delphij@FreeBSD.org .