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