xref: /dflybsd-src/sbin/mount_tmpfs/mount_tmpfs.8 (revision 566ca7464eb5d6900eb6973a39e44199a578ca36)
17a2de9a4SMatthew Dillon.\"	$NetBSD: mount_tmpfs.8,v 1.14 2008/04/30 13:10:53 martin Exp $
27a2de9a4SMatthew Dillon.\"
37a2de9a4SMatthew Dillon.\" Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
47a2de9a4SMatthew Dillon.\" All rights reserved.
57a2de9a4SMatthew Dillon.\"
67a2de9a4SMatthew Dillon.\" This code is derived from software contributed to The NetBSD Foundation
77a2de9a4SMatthew Dillon.\" by Julio M. Merino Vidal, developed as part of Google's Summer of Code
87a2de9a4SMatthew Dillon.\" 2005 program.
97a2de9a4SMatthew Dillon.\"
107a2de9a4SMatthew Dillon.\" Redistribution and use in source and binary forms, with or without
117a2de9a4SMatthew Dillon.\" modification, are permitted provided that the following conditions
127a2de9a4SMatthew Dillon.\" are met:
137a2de9a4SMatthew Dillon.\" 1. Redistributions of source code must retain the above copyright
147a2de9a4SMatthew Dillon.\"    notice, this list of conditions and the following disclaimer.
157a2de9a4SMatthew Dillon.\" 2. Redistributions in binary form must reproduce the above copyright
167a2de9a4SMatthew Dillon.\"    notice, this list of conditions and the following disclaimer in the
177a2de9a4SMatthew Dillon.\"    documentation and/or other materials provided with the distribution.
187a2de9a4SMatthew Dillon.\"
197a2de9a4SMatthew Dillon.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
207a2de9a4SMatthew Dillon.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
217a2de9a4SMatthew Dillon.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
227a2de9a4SMatthew Dillon.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
237a2de9a4SMatthew Dillon.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
247a2de9a4SMatthew Dillon.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
257a2de9a4SMatthew Dillon.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
267a2de9a4SMatthew Dillon.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
277a2de9a4SMatthew Dillon.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
287a2de9a4SMatthew Dillon.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
297a2de9a4SMatthew Dillon.\" POSSIBILITY OF SUCH DAMAGE.
307a2de9a4SMatthew Dillon.\"
31b8170153SSascha Wildner.Dd September 18, 2010
327a2de9a4SMatthew Dillon.Dt MOUNT_TMPFS 8
337a2de9a4SMatthew Dillon.Os
347a2de9a4SMatthew Dillon.Sh NAME
357a2de9a4SMatthew Dillon.Nm mount_tmpfs
367a2de9a4SMatthew Dillon.Nd mount an efficient memory file system
377a2de9a4SMatthew Dillon.Sh SYNOPSIS
387a2de9a4SMatthew Dillon.Nm
39b8170153SSascha Wildner.Op Fl C
40817a2fd9SMatthew Dillon.Op Fl f Ar maxfilesize
417a2de9a4SMatthew Dillon.Op Fl g Ar group
427a2de9a4SMatthew Dillon.Op Fl m Ar mode
437a2de9a4SMatthew Dillon.Op Fl n Ar nodes
447a2de9a4SMatthew Dillon.Op Fl o Ar options
457a2de9a4SMatthew Dillon.Op Fl s Ar size
467a2de9a4SMatthew Dillon.Op Fl u Ar user
477a2de9a4SMatthew Dillon.Ar tmpfs
487a2de9a4SMatthew Dillon.Ar mount_point
497a2de9a4SMatthew Dillon.Sh DESCRIPTION
507a2de9a4SMatthew DillonThe
517a2de9a4SMatthew Dillon.Nm
527a2de9a4SMatthew Dilloncommand attaches an instance of the efficient memory file system to the
537a2de9a4SMatthew Dillonglobal file system namespace.
547a2de9a4SMatthew DillonThe
557a2de9a4SMatthew Dillon.Ar tmpfs
567a2de9a4SMatthew Dillonparameter only exists for compatibility with the other mount commands and
577a2de9a4SMatthew Dillonis ignored.
587a2de9a4SMatthew DillonThe directory specified by
597a2de9a4SMatthew Dillon.Ar mount_point
607a2de9a4SMatthew Dillonis converted to an absolute path before use and its attributes (owner,
61*566ca746SSascha Wildnergroup and mode) are inherited unless explicitly overridden by the options
627a2de9a4SMatthew Dillondescribed below.
637a2de9a4SMatthew Dillon.Pp
647a2de9a4SMatthew DillonThe following options are supported:
657a2de9a4SMatthew Dillon.Bl -tag -width XoXoptions
66b8170153SSascha Wildner.It Fl C
67b8170153SSascha WildnerTells
68b8170153SSascha Wildner.Nm
69b8170153SSascha Wildnerto copy the underlying file system into the tmpfs mount being created
70b8170153SSascha Wildnerover it.
71817a2fd9SMatthew Dillon.It Fl f Ar maxfilesize
72817a2fd9SMatthew DillonSpecifies the maximum file size of the file system.
737a2de9a4SMatthew Dillon.It Fl g Ar group
747a2de9a4SMatthew DillonSpecifies the group name or GID of the root inode of the file system.
757a2de9a4SMatthew DillonDefaults to the mount point's GID.
767a2de9a4SMatthew Dillon.It Fl m Ar mode
777a2de9a4SMatthew DillonSpecifies the mode (in octal notation) of the root inode of the file system.
787a2de9a4SMatthew DillonDefaults to the mount point's mode.
797a2de9a4SMatthew Dillon.It Fl n Ar nodes
807a2de9a4SMatthew DillonSpecifies the maximum number of nodes available to the file system.
817a2de9a4SMatthew DillonIf not specified, the file system chooses a reasonable maximum given its
827a2de9a4SMatthew Dillonsize at mount time, which can be limited with
837a2de9a4SMatthew Dillon.Fl s .
847a2de9a4SMatthew Dillon.It Fl o Ar options
857a2de9a4SMatthew DillonOptions are specified with a
867a2de9a4SMatthew Dillon.Fl o
877a2de9a4SMatthew Dillonflag followed by a comma-separated string of options.
887a2de9a4SMatthew DillonSee the
897a2de9a4SMatthew Dillon.Xr mount 8
90817a2fd9SMatthew Dillonand
91817a2fd9SMatthew Dillon.Xr tmpfs 5
927a2de9a4SMatthew Dillonman page for possible options and their meanings.
937a2de9a4SMatthew Dillon.It Fl s Ar size
94817a2fd9SMatthew DillonSpecifies the total file system size.
957a2de9a4SMatthew DillonIf zero is given (the default), the available amount of memory (including
967a2de9a4SMatthew Dillonmain memory and swap space) will be used.
977a2de9a4SMatthew DillonNote that four megabytes are always reserved for the system and cannot
987a2de9a4SMatthew Dillonbe assigned to the file system.
997a2de9a4SMatthew Dillon.It Fl u Ar user
1007a2de9a4SMatthew DillonSpecifies the user name or UID of the root inode of the file system.
1017a2de9a4SMatthew DillonDefaults to the mount point's UID.
1027a2de9a4SMatthew Dillon.El
1037a2de9a4SMatthew Dillon.Pp
1047a2de9a4SMatthew DillonEvery option that accepts a numerical value as its argument can take a
1057a2de9a4SMatthew Dillontrailing
1067a2de9a4SMatthew Dillon.Sq b
1077a2de9a4SMatthew Dillonto indicate bytes (the default), a trailing
1087a2de9a4SMatthew Dillon.Sq k
1097a2de9a4SMatthew Dillonto indicate kilobytes, a trailing
1107a2de9a4SMatthew Dillon.Sq M
1117a2de9a4SMatthew Dillonto indicate megabytes or a trailing
1127a2de9a4SMatthew Dillon.Sq G
1137a2de9a4SMatthew Dillonto indicate gigabytes.
1147a2de9a4SMatthew DillonNote that both lowercase and uppercase forms of these letters are allowed.
1157a2de9a4SMatthew Dillon.Sh EXAMPLES
1167a2de9a4SMatthew DillonThe following command mounts a tmpfs instance over the
1177a2de9a4SMatthew Dillon.Pa /tmp
1187a2de9a4SMatthew Dillondirectory, inheriting its owner, group and mode settings:
1197a2de9a4SMatthew Dillon.Pp
1207a2de9a4SMatthew Dillon.Ic "mount -t tmpfs tmpfs /tmp"
1217a2de9a4SMatthew Dillon.Pp
1227a2de9a4SMatthew DillonThe following command mounts a tmpfs instance over the
1237a2de9a4SMatthew Dillon.Pa /mnt
1247a2de9a4SMatthew Dillondirectory, setting a 20 megabytes limit in space, owned by the
1257a2de9a4SMatthew Dillon.Sq joe
1267a2de9a4SMatthew Dillonuser and belonging to the
1277a2de9a4SMatthew Dillon.Sq users
1287a2de9a4SMatthew Dillongroup, with a restricted 0700 mode:
1297a2de9a4SMatthew Dillon.Pp
1307a2de9a4SMatthew Dillon.Ic "mount -t tmpfs -o -s20M -o -ujoe -o -gusers -o -m0700 tmpfs /mnt"
1317a2de9a4SMatthew Dillon.Pp
132817a2fd9SMatthew Dillonor
133817a2fd9SMatthew Dillon.Pp
134817a2fd9SMatthew Dillon.Ic "mount -t tmpfs -o size=20M,uid=joe,gid=users,mode=0700 tmpfs /mnt"
1357a2de9a4SMatthew Dillon.Sh SEE ALSO
1367a2de9a4SMatthew Dillon.Xr fstab 5 ,
1373cd583efSSascha Wildner.Xr tmpfs 5 ,
1383cd583efSSascha Wildner.Xr mount 8
1397a2de9a4SMatthew Dillon.Sh HISTORY
1407a2de9a4SMatthew DillonThe
1417a2de9a4SMatthew Dillon.Nm
1427a2de9a4SMatthew Dillonutility first appeared in
1437a2de9a4SMatthew Dillon.Nx 4.0 .
1447a2de9a4SMatthew Dillon.Sh BUGS
1457a2de9a4SMatthew DillonFile system meta-data is not pageable.
1467a2de9a4SMatthew DillonIf there is not enough main memory to hold this information, the system may
1477a2de9a4SMatthew Dillonbecome unstable or very unresponsive because it will not be able to allocate
1487a2de9a4SMatthew Dillonrequired memory.
1497a2de9a4SMatthew DillonA malicious user could trigger this condition if he could create lots of
1507a2de9a4SMatthew Dillonfiles inside a size-unbounded tmpfs file system.
1517a2de9a4SMatthew DillonLimiting the number of nodes per file system
1527a2de9a4SMatthew Dillon.Pq Fl n
1537a2de9a4SMatthew Dillonwill prevent this; the default value for this setting is also often adjusted
1547a2de9a4SMatthew Dillonto an adequate value to resolve this.
155