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