xref: /freebsd/sbin/mount/mount.8 (revision 23f282aa31e9b6fceacd449020e936e98d6f2298)
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.8 (Berkeley) 6/16/94
33.\" $FreeBSD$
34.\"
35.Dd June 16, 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
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
79All the filesystems described in
80.Xr fstab 5
81are mounted.
82Exceptions are those marked as ``noauto'', excluded by the
83.Fl t
84flag (see below), or if they are already mounted (except the
85root filesystem which is always remounted to preserve
86traditional single user mode behavior).
87.It Fl d
88Causes everything to be done except for the actual system call.
89This option is useful in conjunction with the
90.Fl v
91flag to
92determine what the
93.Nm
94command is trying to do.
95.It Fl f
96Forces the revocation of write access when trying to downgrade
97a filesystem mount status from read-write to read-only.
98Also
99forces the R/W mount of an unclean filesystem (dangerous; use with
100caution).
101.It Fl o
102Options are specified with a
103.Fl o
104flag followed by a comma separated string of options.
105In case of conflicting options being specified, the rightmost option
106takes effect.
107The following options are available:
108.Bl -tag -width indent
109.It async
110All
111.Tn I/O
112to the file system should be done asynchronously.
113This is a
114.Em dangerous
115flag to set,
116and should not be used unless you are prepared to recreate the file
117system should your system crash.
118.It current
119When used with the
120.Fl u
121flag, this is the same as specifying the options currently in effect for
122the mounted filesystem.
123.It force
124The same as
125.Fl f ;
126forces the revocation of write access when trying to downgrade
127a filesystem mount status from read-write to read-only.
128Also
129forces the R/W mount of an unclean filesystem (dangerous; use with caution).
130.It fstab
131When used with the
132.Fl u
133flag, this is the same as specifying all the options listed in the
134.Xr fstab 5
135file for the filesystem.
136.It noasync
137Metadata I/O should be done synchronously, while data I/O should be done
138asynchronously.  This is the default.
139.It noatime
140Do not update the file access time when reading from a file.
141This option
142is useful on filesystems where there are large numbers of files and
143performance is more critical than updating the file access time (which is
144rarely ever important). This option is currently only supported on local
145filesystems.
146.It noauto
147This filesystem should be skipped when mount is run with the
148.Fl a
149flag.
150.It noclusterr
151Disable read clustering.
152.It noclusterw
153Disable write clustering.
154.It nodev
155Do not interpret character or block special devices on the file system.
156This option is useful for a server that has file systems containing
157special devices for architectures other than its own.
158.It noexec
159Do not allow execution of any binaries on the mounted file system.
160This option is useful for a server that has file systems containing
161binaries for architectures other than its own.
162.It nosuid
163Do not allow set-user-identifier or set-group-identifier bits to take effect.
164Note: this option is worthless if a public available suid or sgid
165wrapper like
166.Xr suidperl 1
167is installed on your system.
168.It nosymfollow
169Do not follow symlinks
170on the mounted file system.
171.It rdonly
172The same as
173.Fl r ;
174mount the file system read-only (even the super-user may not write it).
175.It sync
176All
177.Tn I/O
178to the file system should be done synchronously.
179.It suiddir
180A directory on the mounted filesystem will respond to the SUID bit
181being set, by setting the owner of any new files to be the same
182as the owner of the directory.
183New directories will inherit the bit from their parents.
184Execute bits are removed from
185the file, and it will not be given to root.
186.Pp
187This feature is designed for use on fileservers serving PC users via
188ftp, SAMBA, or netatalk.
189It provides security holes for shell users and as
190such should not be used on shell machines, especially on home directories.
191This option requires the SUIDDIR
192option in the kernel to work.
193Only UFS filesystems support this option.
194See
195.Xr chmod 2
196for more information.
197.It update
198The same as
199.Fl u ;
200indicate that the status of an already mounted file system should be changed.
201.It union
202Causes the namespace at the mount point to appear as the union
203of the mounted filesystem root and the existing directory.
204Lookups will be done in the mounted filesystem first.
205If those operations fail due to a non-existent file the underlying
206directory is then accessed.
207All creates are done in the mounted filesystem.
208.El
209.Pp
210Any additional options specific to a filesystem type that is not
211one of the internally known types (see the
212.Fl t
213option) may be passed as a comma separated list; these options are
214distinguished by a leading
215.Dq \&-
216(dash).
217Options that take a value are specified using the syntax -option=value.
218For example, the
219.Nm
220command:
221.Bd -literal -offset indent
222mount -t mfs -o nosuid,-N,-s=4000 /dev/dk0b /tmp
223.Ed
224.Pp
225causes
226.Nm
227to execute the equivalent of:
228.Bd -literal -offset indent
229/sbin/mount_mfs -o nosuid -N -s 4000 /dev/dk0b /tmp
230.Ed
231.It Fl p
232Print mount information in fstab format.
233Implies also the
234.Fl v
235option.
236.It Fl r
237The file system is to be mounted read-only.
238Mount the file system read-only (even the super-user may not write it).
239The same as the
240.Dq rdonly
241argument to the
242.Fl o
243option.
244.It Fl t Ar "ufs \\*(Ba lfs \\*(Ba external type"
245The argument following the
246.Fl t
247is used to indicate the file system type.
248The type
249.Ar ufs
250is the default.
251The
252.Fl t
253option can be used
254to indicate that the actions should only be taken on
255filesystems of the specified type.
256More than one type may be specified in a comma separated list.
257The list of filesystem types can be prefixed with
258.Dq no
259to specify the filesystem types for which action should
260.Em not
261be taken.
262For example, the
263.Nm
264command:
265.Bd -literal -offset indent
266mount -a -t nonfs,mfs
267.Ed
268.Pp
269mounts all filesystems except those of type
270.Tn NFS
271and
272.Tn MFS .
273.Pp
274If the type is not one of the internally known types,
275.Nm
276will attempt to execute a program in
277.Pa /sbin/mount_ Ns Em XXX
278where
279.Em XXX
280is replaced by the type name.
281For example, nfs filesystems are mounted by the program
282.Pa /sbin/mount_nfs .
283.Pp
284Most filesystems will be dynamically loaded by their mount programs
285if not already present in the kernel, using the
286.Xr vfsload 3
287subroutine.  Because this mechanism requires writable temporary space,
288the filesystem type containing
289.Pa /tmp
290must be compiled into the kernel, and the filesystems containing
291.Pa /tmp
292and
293.Pa /usr/bin/ld
294must be listed in
295.Pa /etc/fstab
296before any filesystems which might be dynamically loaded.
297.It Fl u
298The
299.Fl u
300flag indicates that the status of an already mounted file
301system should be changed.
302Any of the options discussed above (the
303.Fl o
304option)
305may be changed;
306also a file system can be changed from read-only to read-write
307or vice versa.
308An attempt to change from read-write to read-only will fail if any
309files on the filesystem are currently open for writing unless the
310.Fl f
311flag is also specified.
312The set of options is determined by applying the options specified
313in the argument to
314.Fl o
315and finally applying the
316.Fl r
317or
318.Fl w
319option.
320.It Fl v
321Verbose mode.
322.It Fl w
323The file system object is to be read and write.
324.Pp
325The options specific to NFS filesystems are described in the
326.Xr mount_nfs 8
327manual page.
328.Sh DIAGNOSTICS
329Various, most of them are self-explanatory.
330.Pp
331.Dl XXXXX filesystem is not available
332.Pp
333The kernel doesn't support the respective filesystem type.  Note that
334support for a particular filesystem might be provided either on a static
335(kernel compile-time), or dynamic basis (loaded as a kernel module by
336.Xr kldload 8 ).
337Normally,
338.Nm
339or its subprocesses attempt to dynamically load a filesystem module if
340it hasn't been configured statically, using
341.Xr vfsload 3 .
342In this case, the above error message can also mean that you didn't
343have permission to load the module.
344.Sh FILES
345.Bl -tag -width /etc/fstab -compact
346.It Pa /etc/fstab
347file system table
348.El
349.Sh SEE ALSO
350.Xr mount 2 ,
351.Xr vfsload 3 ,
352.Xr fstab 5 ,
353.Xr kldload 8 ,
354.Xr mount_cd9660 8 ,
355.Xr mount_devfs 8 ,
356.Xr mount_fdesc 8 ,
357.Xr mount_kernfs 8 ,
358.Xr mount_mfs 8 ,
359.Xr mount_msdos 8 ,
360.Xr mount_nfs 8 ,
361.Xr mount_null 8 ,
362.Xr mount_portal 8 ,
363.Xr mount_procfs 8 ,
364.Xr mount_umap 8 ,
365.Xr mount_union 8 ,
366.Xr umount 8
367.Sh BUGS
368It is possible for a corrupted file system to cause a crash.
369.Sh CAVEATS
370After a successful mount, the permissions on the original mount point
371determine if
372.Pa ".."
373is accessible from the mounted file system.  The minimum permissions for
374the mount point for traversal across the mount point in both
375directions to be possible for all users is 0111 (execute for all).
376.Sh HISTORY
377A
378.Nm
379command appeared in
380.At v1 .
381