xref: /freebsd/sbin/mount/mount.8 (revision 17ee9d00bc1ae1e598c38f25826f861e4bc6c3ce)
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.\"
34.Dd March 27, 1994
35.Dt MOUNT 8
36.Os BSD 4
37.Sh NAME
38.Nm mount
39.Nd mount file systems
40.Sh SYNOPSIS
41.Nm mount
42.Op Fl adfruvw
43.Op Fl t Ar ufs | lfs | external_type
44.Nm mount
45.Op Fl dfruvw
46.Ar special | node
47.Nm mount
48.Op Fl dfruvw
49.Op Fl o Ar options
50.Op Fl t Ar ufs | lfs | external_type
51.Ar special node
52.Sh DESCRIPTION
53The
54.Nm mount
55command
56calls the
57.Xr mount 2
58system call to prepare and graft a
59.Ar "special device"
60or the remote node (rhost:path) on to the file system tree at the point
61.Ar node .
62If either
63.Ar special
64or
65.Ar node
66are not provided, the appropriate information is taken from the
67.Xr fstab 5
68file.
69.Pp
70The system maintains a list of currently mounted file systems.
71If no arguments are given to
72.Nm mount,
73this list is printed.
74.Pp
75The options are as follows:
76.Bl -tag -width indent
77.It Fl d
78Causes everything to be done except for the actual system call.
79This option is useful in conjunction with the
80.Fl v
81flag to
82determine what the
83.Nm mount
84command is trying to do.
85.It Fl f
86Forces the revocation of write access when trying to downgrade
87a filesystem mount status from read-write to read-only.
88.It Fl o
89Options are specified with a
90.Fl o
91flag followed by a comma separated string of options.
92The following options are available:
93.Bl -tag -width indent
94.It async
95All
96.Tn I/O
97to the file system should be done asynchronously.
98This is a
99.Em dangerous
100flag to set,
101and should not be used unless you are prepared to recreate the file
102system should your system crash.
103.It force
104The same as
105.Fl f ;
106forces the revocation of write access when trying to downgrade
107a filesystem mount status from read-write to read-only.
108.It nodev
109Do not interpret character or block special devices on the file system.
110This option is useful for a server that has file systems containing
111special devices for architectures other than its own.
112.It noexec
113Do not allow execution of any binaries on the mounted file system.
114This option is useful for a server that has file systems containing
115binaries for architectures other than its own.
116.It nosuid
117Do not allow set-user-identifier or set-group-identifier bits to take effect.
118.It rdonly
119The same as
120.Fl r ;
121mount the file system read-only (even the super-user may not write it).
122.It sync
123All
124.Tn I/O
125to the file system should be done synchronously.
126.It update
127The same as
128.Fl u ;
129indicate that the status of an already mounted file system should be changed.
130.It union
131Causes the namespace at the mount point to appear as the union
132of the mounted filesystem root and the existing directory.
133Lookups will be done in the mounted filesystem first.
134If those operations fail due to a non-existent file the underlying
135directory is then accessed.
136All creates are done in the mounted filesystem.
137.El
138.Pp
139Any additional options specific to a filesystem type that is not
140one of the internally known types (see the
141.Fl t
142option) may be passed as a comma separated list; these options are
143distinguished by a leading
144.Dq \&-
145(dash).
146Options that take a value are specified using the syntax -option=value.
147For example, the mount command:
148.Bd -literal -offset indent
149mount -t mfs -o nosuid,-N,-s=4000 /dev/dk0b /tmp
150.Ed
151.Pp
152causes
153.Nm mount
154to execute the equivalent of:
155.Bd -literal -offset indent
156/sbin/mount_mfs -o nosuid -N -s 4000 /dev/dk0b /tmp
157.Ed
158.It Fl r
159The file system is to be mounted read-only.
160Mount the file system read-only (even the super-user may not write it).
161The same as the
162.Dq rdonly
163argument to the
164.Fl o
165option.
166.It Fl t Ar "ufs \\*(Ba lfs \\*(Ba external type"
167The argument following the
168.Fl t
169is used to indicate the file system type.
170The type
171.Ar ufs
172is the default.
173The
174.Fl t
175option can be used
176to indicate that the actions should only be taken on
177filesystems of the specified type.
178More than one type may be specified in a comma separated list.
179The list of filesystem types can be prefixed with
180.Dq no
181to specify the filesystem types for which action should
182.Em not
183be taken.
184For example, the
185.Nm mount
186command:
187.Bd -literal -offset indent
188mount -a -t nonfs,mfs
189.Ed
190.Pp
191mounts all filesystems except those of type
192.Tn NFS
193and
194.Tn MFS .
195.Pp
196If the type is not one of the internally known types,
197mount will attempt to execute a program in
198.Pa /sbin/mount_ Ns Em XXX
199where
200.Em XXX
201is replaced by the type name.
202For example, nfs filesystems are mounted by the program
203.Pa /sbin/mount_nfs .
204.Pp
205Most filesystems will be dynamically loaded by their mount programs
206if not already present in the kernel, using the
207.Xr vfsload 3
208subroutine.  Because this mechanism requires writable temporary space,
209the filesystem type containing
210.Pa /tmp
211must be compiled into the kernel, and the filesystems containing
212.Pa /tmp
213and
214.Pa /usr/bin/ld
215must be listed in
216.Pa /etc/fstab
217before any filesystems which might be dynamically loaded.
218.It Fl u
219The
220.Fl u
221flag indicates that the status of an already mounted file
222system should be changed.
223Any of the options discussed above (the
224.Fl o
225option)
226may be changed;
227also a file system can be changed from read-only to read-write
228or vice versa.
229An attempt to change from read-write to read-only will fail if any
230files on the filesystem are currently open for writing unless the
231.Fl f
232flag is also specified.
233The set of options is determined by first extracting the options
234for the file system from the
235.Xr fstab
236table,
237then applying any options specified by the
238.Fl o
239argument,
240and finally applying the
241.Fl r
242or
243.Fl w
244option.
245.It Fl v
246Verbose mode.
247.It Fl w
248The file system object is to be read and write.
249.Pp
250The options specific to NFS filesystems are described in the
251.Xr mount_nfs 8
252manual page.
253.Sh FILES
254.Bl -tag -width /etc/fstab -compact
255.It Pa /etc/fstab
256file system table
257.El
258.Sh SEE ALSO
259.Xr mount 2 ,
260.Xr vfsload 3 ,
261.Xr fstab 5 ,
262.Xr mount_cd9660 8 ,
263.Xr mount_fdesc 8 ,
264.Xr mount_kernfs 8 ,
265.Xr mount_lfs 8 ,
266.Xr mount_lofs 8 ,
267.Xr mount_mfs 8 ,
268.Xr mount_nfs 8 ,
269.Xr mount_null 8 ,
270.Xr mount_portal 8 ,
271.Xr mount_procfs 8 ,
272.Xr mount_umap 8 ,
273.Xr mount_union 8 ,
274.Xr umount 8
275.Sh BUGS
276It is possible for a corrupted file system to cause a crash.
277.Sh HISTORY
278A
279.Nm mount
280command appeared in
281.At v6 .
282