2 .\" Copyright (c) 2007 Xin LI
3 .\" Copyright (c) 2017 The FreeBSD Foundation, Inc.
5 .\" Part of this documentation was written by
6 .\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
7 .\" from the FreeBSD Foundation.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 .\" Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
31 .\" All rights reserved.
33 .\" Redistribution and use in source and binary forms, with or without
34 .\" modification, are permitted provided that the following conditions
36 .\" 1. Redistributions of source code must retain the above copyright
37 .\" notice, this list of conditions and the following disclaimer.
38 .\" 2. Redistributions in binary form must reproduce the above copyright
39 .\" notice, this list of conditions and the following disclaimer in the
40 .\" documentation and/or other materials provided with the distribution.
42 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
43 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
44 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
45 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
46 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
47 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
48 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
49 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
50 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
52 .\" POSSIBILITY OF SUCH DAMAGE.
54 .Dd September 18, 2023
59 .Nd "in-memory file system"
61 To compile this driver into the kernel,
62 place the following line in your
63 kernel configuration file:
64 .Bd -ragged -offset indent
68 Alternatively, to load the driver as a
69 module at boot time, place the following line in
71 .Bd -literal -offset indent
77 driver implements an in-memory, or
80 The filesystem stores both file metadata and data in main memory.
81 This allows very fast and low latency accesses to the data.
83 An umount or system reboot invalidates it.
84 These properties make the filesystem's mounts suitable for fast
88 If the system becomes low on memory and swap is configured
91 the system can transfer file data to swap space, freeing memory
93 Metadata, including the directory content, is never swapped out by the
94 current implementation.
95 Keep this in mind when planning the mount limits, especially when expecting
96 to place many small files on a tmpfs mount.
100 is used on a file from a tmpfs mount, the swap VM object managing the
101 file pages is used to implement mapping and avoid double-copying of
103 This quirk causes process inspection tools, like
105 to report anonymous memory mappings instead of file mappings.
107 The following options are available when
111 .Bl -tag -width "maxfilesize"
113 Set the maximum memory size used by extended attributes in bytes.
114 The default is 16 megabytes.
118 option for compatibility with
120 This option does nothing.
122 Set the group ID of the root inode of the file system.
123 The default is the mount point's GID.
125 Set the maximum number of nodes available to the file system.
126 If not specified, the file system chooses a reasonable maximum based on
127 the file system size, which can be limited with the
131 Set the maximum file size in bytes.
132 The default is the maximum possible value.
134 Set the mode (in octal notation) of the root inode of the file system.
135 The default is the mount point's mode.
137 Disable the tracking of mtime updates caused by writes to the
138 shared mapped areas backed by
141 This option removes periodic scans,
142 which downgrade read-write-mapped pages to read-only to note the writes.
144 Do not use namecache to resolve names to files for the created mount.
145 This saves memory, but currently might impair scalability for highly
146 used mounts on large machines.
150 on the mounted file system.
152 Enable pgcache read for the mount.
154 Set the total file system size in bytes, unless suffixed
155 with one of k, m, g, t, or p, which denote byte, kilobyte,
156 megabyte, gigabyte, terabyte and petabyte respectively.
157 If zero (the default) or a value larger than SIZE_MAX - PAGE_SIZE
158 is given, the available amount of memory (including
159 main memory and swap space) will be used.
161 Set the user ID of the root inode of the file system.
162 The default is the mount point's UID.
170 variables are available:
171 .Bl -tag -width indent
172 .It Va vfs.tmpfs.memory_percent
173 The percentage of memory plus swap space available at kernel file system
174 initialization that can be used by a file system with a size of 0.
175 When this amount of space in use is reached, new files cannot be created
176 and files cannot be extended.
178 Changing this value also changes
179 .Va vfs.tmpfs.memory_reserved .
180 .It Va vfs.tmpfs.memory_reserved
181 The currently-reserved amount of memory plus swap space
182 based on the memory percentage.
183 The minimum is compiled into the system, and defaults to 4 MB.
190 .Dl "mount -t tmpfs tmpfs /tmp"
196 .Bd -literal -offset indent
197 tmpfs /tmp tmpfs rw 0 0
212 driver first appeared in
218 kernel implementation was written by
219 .An Julio M. Merino Vidal Aq Mt jmmv@NetBSD.org
220 as a Google Summer of Code project.
223 and others ported it from
228 This manual page was written by
229 .An Xin LI Aq Mt delphij@FreeBSD.org .