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