xref: /openbsd/sbin/mount_tmpfs/mount_tmpfs.8 (revision 73471bf0)
1.\"	$OpenBSD: mount_tmpfs.8,v 1.4 2014/11/16 02:22:10 brad Exp $
2.\"	$NetBSD: mount_tmpfs.8,v 1.14 2008/04/30 13:10:53 martin Exp $
3.\"
4.\" Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
5.\" All rights reserved.
6.\"
7.\" This code is derived from software contributed to The NetBSD Foundation
8.\" by Julio M. Merino Vidal, developed as part of Google's Summer of Code
9.\" 2005 program.
10.\"
11.\" Redistribution and use in source and binary forms, with or without
12.\" modification, are permitted provided that the following conditions
13.\" are met:
14.\" 1. Redistributions of source code must retain the above copyright
15.\"    notice, this list of conditions and the following disclaimer.
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\"    notice, this list of conditions and the following disclaimer in the
18.\"    documentation and/or other materials provided with the distribution.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30.\" POSSIBILITY OF SUCH DAMAGE.
31.\"
32.Dd $Mdocdate: November 16 2014 $
33.Dt MOUNT_TMPFS 8
34.Os
35.Sh NAME
36.Nm mount_tmpfs
37.Nd mount an efficient memory file system
38.Sh SYNOPSIS
39.Nm
40.Op Fl g Ar group
41.Op Fl m Ar mode
42.Op Fl n Ar nodes
43.Op Fl o Ar options
44.Op Fl s Ar size
45.Op Fl u Ar user
46.Ar tmpfs
47.Ar mount_point
48.Sh DESCRIPTION
49The
50.Nm
51command attaches an instance of the efficient memory file system to the
52global file system namespace.
53The
54.Ar tmpfs
55parameter only exists for compatibility with the other mount commands and
56is ignored.
57The directory specified by
58.Ar mount_point
59is converted to an absolute path before use and its attributes (owner,
60group and mode) are inherited unless explicitly overridden by the options
61described below.
62.Pp
63The following options are supported:
64.Bl -tag -width XoXoptions
65.It Fl g Ar group
66Specifies the group name or GID of the root inode of the file system.
67Defaults to the mount point's GID.
68.It Fl m Ar mode
69Specifies the mode (in octal notation) of the root inode of the file system.
70Defaults to the mount point's mode.
71.It Fl n Ar nodes
72Specifies the maximum number of nodes available to the file system.
73If not specified, the file system chooses a reasonable maximum given its
74size at mount time, which can be limited with
75.Fl s .
76.It Fl o Ar options
77Options are specified with a
78.Fl o
79flag followed by a comma-separated string of options.
80See the
81.Xr mount 8
82man page for possible options and their meanings.
83.It Fl s Ar size
84Specifies the total file system size in bytes.
85If zero is given (the default), the available amount of memory (including
86main memory and swap space) will be used.
87Note that four megabytes are always reserved for the system and cannot
88be assigned to the file system.
89.It Fl u Ar user
90Specifies the user name or UID of the root inode of the file system.
91Defaults to the mount point's UID.
92.El
93.Pp
94Every option that accepts a numerical value as its argument can take a
95trailing
96.Sq b
97to indicate bytes (the default), a
98.Sq k
99to indicate kilobytes, a
100.Sq M
101to indicate megabytes or a
102.Sq G
103to indicate gigabytes.
104Note that both lowercase and uppercase forms of these letters are allowed.
105.Sh EXAMPLES
106The following command mounts a tmpfs instance over the
107.Pa /tmp
108directory, inheriting its owner, group and mode settings:
109.Pp
110.Dl # mount -t tmpfs tmpfs /tmp
111.Pp
112The following command mounts a tmpfs instance over the
113.Pa /mnt
114directory, setting a 20 megabytes limit in space, owned by the
115.Sq joe
116user and belonging to the
117.Sq users
118group, with a restricted 0700 mode:
119.Pp
120.Dl # mount -t tmpfs -o -s20M -o -ujoe -o -gusers -o -m0700 tmpfs /mnt
121.Pp
122A corresponding
123.Xr fstab 5
124entry, using "swap" as a place holder:
125.Pp
126.Dl swap /mnt tmpfs rw,-s20M,-ujoe,-gusers,-m0700 0 0
127.Sh SEE ALSO
128.Xr fstab 5 ,
129.Xr mount 8
130.Sh HISTORY
131The
132.Nm
133utility first appeared in
134.Nx 4.0
135and
136.Ox 5.5 .
137.Sh CAVEATS
138The update of mount options (through mount -u) is currently not supported.
139.Sh BUGS
140File system meta-data is not pageable.
141If there is not enough main memory to hold this information, the system may
142become unstable or very unresponsive because it will not be able to allocate
143required memory.
144A malicious user could trigger this condition if he could create lots of
145files inside a size-unbounded tmpfs file system.
146Limiting the number of nodes per file system
147.Pq Fl n
148will prevent this; the default value for this setting is also often adjusted
149to an adequate value to resolve this.
150