xref: /freebsd/sbin/mount/mount.8 (revision e627b39baccd1ec9129690167cf5e6d860509655)
1.\" Copyright (c) 1980, 1989, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"     @(#)mount.8	8.7 (Berkeley) 3/27/94
33.\"	$Id: mount.8,v 1.10 1996/08/29 18:06:02 wosch Exp $
34.\"
35.Dd March 27, 1994
36.Dt MOUNT 8
37.Os BSD 4
38.Sh NAME
39.Nm mount
40.Nd mount file systems
41.Sh SYNOPSIS
42.Nm mount
43.Op Fl adfpruvw
44.Op Fl t Ar ufs | lfs | external_type
45.Nm mount
46.Op Fl dfpruvw
47.Ar special | node
48.Nm mount
49.Op Fl dfpruvw
50.Op Fl o Ar options
51.Op Fl t Ar ufs | lfs | external_type
52.Ar special node
53.Sh DESCRIPTION
54The
55.Nm mount
56command
57calls the
58.Xr mount 2
59system call to prepare and graft a
60.Ar "special device"
61or the remote node (rhost:path) on to the file system tree at the point
62.Ar node .
63If either
64.Ar special
65or
66.Ar node
67are not provided, the appropriate information is taken from the
68.Xr fstab 5
69file.
70.Pp
71The system maintains a list of currently mounted file systems.
72If no arguments are given to
73.Nm mount,
74this list is printed.
75.Pp
76The options are as follows:
77.Bl -tag -width indent
78.It Fl a
79Causes all filesystems listed in
80.Pa /etc/fstab
81(except those with the ``noauto'' option) to be mounted. This is normally
82done during system startup.
83.It Fl d
84Causes everything to be done except for the actual system call.
85This option is useful in conjunction with the
86.Fl v
87flag to
88determine what the
89.Nm mount
90command is trying to do.
91.It Fl f
92Forces the revocation of write access when trying to downgrade
93a filesystem mount status from read-write to read-only. Also
94forces the R/W mount of an unclean filesystem (dangerous; use with
95caution).
96.It Fl o
97Options are specified with a
98.Fl o
99flag followed by a comma separated string of options.
100The following options are available:
101.Bl -tag -width indent
102.It async
103All
104.Tn I/O
105to the file system should be done asynchronously.
106This is a
107.Em dangerous
108flag to set,
109and should not be used unless you are prepared to recreate the file
110system should your system crash.
111.It force
112The same as
113.Fl f ;
114forces the revocation of write access when trying to downgrade
115a filesystem mount status from read-write to read-only. Also
116forces the R/W mount of an unclean filesystem (dangerous; use with caution).
117.It noatime
118Do not update the file access time when reading from a file. This option
119is useful on filesystems where there are large numbers of files and
120performance is more critical than updating the file access time (which is
121rarely ever important). This option is currently only supported on local
122filesystems.
123.It nodev
124Do not interpret character or block special devices on the file system.
125This option is useful for a server that has file systems containing
126special devices for architectures other than its own.
127.It noexec
128Do not allow execution of any binaries on the mounted file system.
129This option is useful for a server that has file systems containing
130binaries for architectures other than its own.
131.It nosuid
132Do not allow set-user-identifier or set-group-identifier bits to take effect.
133Note: this option is worthless if a public available suid or sgid
134wrapper like
135.Xr suidperl
136is installed on your system.
137.It rdonly
138The same as
139.Fl r ;
140mount the file system read-only (even the super-user may not write it).
141.It sync
142All
143.Tn I/O
144to the file system should be done synchronously.
145.It update
146The same as
147.Fl u ;
148indicate that the status of an already mounted file system should be changed.
149.It union
150Causes the namespace at the mount point to appear as the union
151of the mounted filesystem root and the existing directory.
152Lookups will be done in the mounted filesystem first.
153If those operations fail due to a non-existent file the underlying
154directory is then accessed.
155All creates are done in the mounted filesystem.
156.El
157.Pp
158Any additional options specific to a filesystem type that is not
159one of the internally known types (see the
160.Fl t
161option) may be passed as a comma separated list; these options are
162distinguished by a leading
163.Dq \&-
164(dash).
165Options that take a value are specified using the syntax -option=value.
166For example, the mount command:
167.Bd -literal -offset indent
168mount -t mfs -o nosuid,-N,-s=4000 /dev/dk0b /tmp
169.Ed
170.Pp
171causes
172.Nm mount
173to execute the equivalent of:
174.Bd -literal -offset indent
175/sbin/mount_mfs -o nosuid -N -s 4000 /dev/dk0b /tmp
176.Ed
177.It Fl p
178Print mount information in fstab format. Implies also the
179.Fl v
180option.
181.It Fl r
182The file system is to be mounted read-only.
183Mount the file system read-only (even the super-user may not write it).
184The same as the
185.Dq rdonly
186argument to the
187.Fl o
188option.
189.It Fl t Ar "ufs \\*(Ba lfs \\*(Ba external type"
190The argument following the
191.Fl t
192is used to indicate the file system type.
193The type
194.Ar ufs
195is the default.
196The
197.Fl t
198option can be used
199to indicate that the actions should only be taken on
200filesystems of the specified type.
201More than one type may be specified in a comma separated list.
202The list of filesystem types can be prefixed with
203.Dq no
204to specify the filesystem types for which action should
205.Em not
206be taken.
207For example, the
208.Nm mount
209command:
210.Bd -literal -offset indent
211mount -a -t nonfs,mfs
212.Ed
213.Pp
214mounts all filesystems except those of type
215.Tn NFS
216and
217.Tn MFS .
218.Pp
219If the type is not one of the internally known types,
220mount will attempt to execute a program in
221.Pa /sbin/mount_ Ns Em XXX
222where
223.Em XXX
224is replaced by the type name.
225For example, nfs filesystems are mounted by the program
226.Pa /sbin/mount_nfs .
227.Pp
228Most filesystems will be dynamically loaded by their mount programs
229if not already present in the kernel, using the
230.Xr vfsload 3
231subroutine.  Because this mechanism requires writable temporary space,
232the filesystem type containing
233.Pa /tmp
234must be compiled into the kernel, and the filesystems containing
235.Pa /tmp
236and
237.Pa /usr/bin/ld
238must be listed in
239.Pa /etc/fstab
240before any filesystems which might be dynamically loaded.
241.It Fl u
242The
243.Fl u
244flag indicates that the status of an already mounted file
245system should be changed.
246Any of the options discussed above (the
247.Fl o
248option)
249may be changed;
250also a file system can be changed from read-only to read-write
251or vice versa.
252An attempt to change from read-write to read-only will fail if any
253files on the filesystem are currently open for writing unless the
254.Fl f
255flag is also specified.
256The set of options is determined by first extracting the options
257for the file system from the
258.Xr fstab
259table,
260then applying any options specified by the
261.Fl o
262argument,
263and finally applying the
264.Fl r
265or
266.Fl w
267option.
268.It Fl v
269Verbose mode.
270.It Fl w
271The file system object is to be read and write.
272.Pp
273The options specific to NFS filesystems are described in the
274.Xr mount_nfs 8
275manual page.
276.Sh FILES
277.Bl -tag -width /etc/fstab -compact
278.It Pa /etc/fstab
279file system table
280.El
281.Sh SEE ALSO
282.Xr mount 2 ,
283.Xr vfsload 3 ,
284.Xr fstab 5 ,
285.Xr mount_cd9660 8 ,
286.Xr mount_fdesc 8 ,
287.Xr mount_kernfs 8 ,
288.Xr mount_lfs 8 ,
289.Xr mount_mfs 8 ,
290.Xr mount_nfs 8 ,
291.Xr mount_null 8 ,
292.Xr mount_portal 8 ,
293.Xr mount_procfs 8 ,
294.Xr mount_umap 8 ,
295.Xr mount_union 8 ,
296.Xr umount 8
297.Sh BUGS
298It is possible for a corrupted file system to cause a crash.
299.Sh HISTORY
300A
301.Nm mount
302command appeared in
303.At v1 .
304