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