xref: /dragonfly/sbin/mount/mount.8 (revision 655933d6)
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. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.\"     @(#)mount.8	8.8 (Berkeley) 6/16/94
29.\" $FreeBSD: src/sbin/mount/mount.8,v 1.31.2.12 2003/02/23 21:17:42 trhodes Exp $
30.\"
31.Dd May 15, 2016
32.Dt MOUNT 8
33.Os
34.Sh NAME
35.Nm mount
36.Nd mount file systems
37.Sh SYNOPSIS
38.Nm
39.Op Fl adfpruvw
40.Op Fl F Ar fstab
41.Op Fl o Ar options
42.Op Fl t Ar type
43.Nm
44.Op Fl dfpruvw
45.Brq Ar special | node
46.Nm
47.Op Fl dfpruvw
48.Op Fl o Ar options
49.Op Fl t Ar type
50.Ar special node
51.Sh DESCRIPTION
52The
53.Nm
54utility calls the
55.Xr mount 2
56system call to prepare and graft a
57.Ar "special device"
58or the remote node (rhost:path) or a HAMMER2 label (@label) on to the
59file system tree at the point
60.Ar node .
61If either
62.Ar special
63or
64.Ar node
65are not provided, the appropriate information is taken from the
66.Xr fstab 5
67file.
68.Pp
69The system maintains a list of currently mounted file systems.
70If no arguments are given to
71.Nm ,
72this list is printed.
73.Pp
74The options are as follows:
75.Bl -tag -width indent
76.It Fl a
77All the filesystems described in
78.Xr fstab 5
79are mounted.
80Exceptions are those marked as
81.Dq noauto ,
82excluded 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 Ar fstab
96Specify the
97.Pa fstab
98file to use.
99.It Fl f
100Forces the revocation of write access when trying to downgrade
101a filesystem mount status from read-write to read-only.
102Also
103forces the R/W mount of an unclean filesystem (dangerous; use with
104caution).
105.It Fl o
106Options are specified with a
107.Fl o
108flag followed by a comma separated string of options.
109If a
110.Dq no
111prefix is added or removed from an option name, then meaning is negated.
112In case of conflicting options being specified, the rightmost option
113takes effect.
114The following options are available:
115.Bl -tag -width indent
116.It Cm async
117All
118.Tn I/O
119to the file system should be done asynchronously.
120This is a
121.Em dangerous
122flag to set,
123and should not be used unless you are prepared to recreate the file
124system should your system crash.
125.It Cm automounted
126This flag indicates that the file system was mounted by
127.Xr automountd 8 .
128Automounted file systems are automatically unmounted by
129.Xr autounmountd 8 .
130.It Cm current
131When used with the
132.Fl u
133flag, this is the same as specifying the options currently in effect for
134the mounted filesystem.
135.It Cm force
136The same as
137.Fl f ;
138forces the revocation of write access when trying to downgrade
139a filesystem mount status from read-write to read-only.
140Also
141forces the R/W mount of an unclean filesystem (dangerous; use with caution).
142.It Cm fstab
143When used with the
144.Fl u
145flag, this is the same as specifying all the options listed in the
146.Xr fstab 5
147file for the filesystem.
148.It Cm noasync
149Metadata I/O should be done synchronously, while data I/O should be done
150asynchronously.
151This is the default.
152.It Cm noatime
153Do not update the file access time when reading from a file.
154This option
155is useful on filesystems where there are large numbers of files and
156performance is more critical than updating the file access time (which is
157rarely ever important).
158This option is currently only supported on local filesystems.
159.It Cm noauto
160This filesystem should be skipped when
161.Nm
162is run with the
163.Fl a
164flag.
165.It Cm noclusterr
166Disable read clustering.
167.It Cm noclusterw
168Disable write clustering.
169.It Cm nodev
170Do not interpret character or block special devices on the file system.
171This option is useful for a server that has file systems containing
172special devices for architectures other than its own.
173This option is set automatically when the user does not have super-user
174privileges.
175.It Cm noexec
176Do not allow execution of any binaries on the mounted file system.
177This option is useful for a server that has file systems containing
178binaries for architectures other than its own.
179.It Cm nosuid
180Do not allow set-user-identifier or set-group-identifier bits to take effect.
181Note: this option is worthless if a publicly available suid or sgid
182wrapper like
183.Xr suidperl 1
184is installed on your system.
185It is set automatically when the user does not have super-user privileges.
186.It Cm nosymfollow
187Do not follow symlinks
188on the mounted file system.
189.It Cm rdonly , ro , norw
190The same as
191.Fl r ;
192mount the file system read-only (even the super-user may not write it).
193.It Cm sync
194All
195.Tn I/O
196to the file system should be done synchronously.
197.It Cm trim
198If the device supports TRIM
199.Va ( kern.cam.da.X.trim_enabled
200exists) and is set,
201the file system will perform online trim for corresponding block deletions.
202Currently, only
203.Xr UFS 5
204supports this feature.
205.It Cm suiddir
206A directory on the mounted filesystem will respond to the SUID bit
207being set, by setting the owner of any new files to be the same
208as the owner of the directory.
209New directories will inherit the bit from their parents.
210Execute bits are removed from
211the file, and it will not be given to root.
212.Pp
213This feature is designed for use on fileservers serving PC users via
214ftp or SAMBA.
215It provides security holes for shell users and as
216such should not be used on shell machines, especially on home directories.
217This option requires the SUIDDIR
218option in the kernel to work.
219Only
220.Xr UFS 5
221filesystems support this option.
222See
223.Xr chmod 2
224for more information.
225.It Cm update
226The same as
227.Fl u ;
228indicate that the status of an already mounted file system should be changed.
229.It Cm ignore
230Will be ignored by
231.Xr df 1 .
232.El
233.Pp
234Any additional options specific to a filesystem type that is not
235one of the internally known types (see the
236.Fl t
237option) may be passed as a comma separated list; these options are
238distinguished by a leading
239.Dq \&-
240(dash).
241Options that take a value are specified using the syntax -option=value.
242For example, the
243.Nm
244command:
245.Bd -literal -offset indent
246mount -t mfs -o nosuid,-N,-s=4000 /dev/da0s0b /tmp
247.Ed
248.Pp
249causes
250.Nm
251to execute the equivalent of:
252.Bd -literal -offset indent
253/sbin/mount_mfs -o nosuid -N -s 4000 /dev/da0s0b /tmp
254.Ed
255.Pp
256Additional options specific to filesystem types
257which are not internally known
258(see the description of the
259.Fl t
260option below)
261may be described in the manual pages for the associated
262.Pa /sbin/mount_ Ns Sy XXX
263utilities.
264.It Fl p
265Print mount information in
266.Xr fstab 5
267format.
268If fstab is missing or if the freq and passno fields are omitted,
269the default values as described in
270.Xr fstab 5
271are used.
272Implies also the
273.Fl v
274option.
275.It Fl r
276The file system is to be mounted read-only.
277Mount the file system read-only (even the super-user may not write it).
278The same as the
279.Cm rdonly
280argument to the
281.Fl o
282option.
283.It Fl t Ar type
284The argument following the
285.Fl t
286is used to indicate the file system type.
287The type
288.Cm ufs
289is the default.
290The
291.Fl t
292option can be used
293to indicate that the actions should only be taken on
294filesystems of the specified type.
295More than one type may be specified in a comma separated list.
296The list of filesystem types can be prefixed with
297.Dq no
298to specify the filesystem types for which action should
299.Em not
300be taken.
301For example, the
302.Nm
303command:
304.Bd -literal -offset indent
305mount -a -t nonfs,mfs
306.Ed
307.Pp
308mounts all filesystems except those of type
309.Tn NFS
310and
311.Tn MFS .
312.Pp
313If the type is not the internally known type,
314.Cm ufs ,
315.Nm
316will attempt to execute a program in
317.Pa /sbin/mount_ Ns Sy XXX
318where
319.Sy XXX
320is replaced by the type name.
321For example, nfs filesystems are mounted by the program
322.Pa /sbin/mount_nfs .
323.Pp
324Most filesystems will be dynamically loaded by their
325.Nm
326programs
327if not already present in the kernel, using the
328.Xr vfsload 3
329subroutine.
330Because this mechanism requires writable temporary space,
331the filesystem type containing
332.Pa /tmp
333must be compiled into the kernel, and the filesystems containing
334.Pa /tmp
335and
336.Pa /usr/bin/ld
337must be listed in
338.Pa /etc/fstab
339before any filesystems which might be dynamically loaded.
340.It Fl u
341The
342.Fl u
343flag indicates that the status of an already mounted file
344system should be changed.
345Any of the options discussed above (the
346.Fl o
347option)
348may be changed;
349also a file system can be changed from read-only to read-write
350or vice versa.
351An attempt to change from read-write to read-only will fail if any
352files on the filesystem are currently open for writing unless the
353.Fl f
354flag is also specified.
355The set of options is determined by applying the options specified
356in the argument to
357.Fl o
358and finally applying the
359.Fl r
360or
361.Fl w
362option.
363.It Fl v
364Verbose mode.
365.It Fl w
366The file system object is to be read and write.
367.El
368.Sh ENVIRONMENT
369.Bl -tag -width PATH_FSTAB
370.It Pa PATH_FSTAB
371If the environment variable
372.Pa PATH_FSTAB
373is set all operations are performed against the specified file.
374.El
375.Sh FILES
376.Bl -tag -width /etc/fstab -compact
377.It Pa /etc/fstab
378file system table
379.El
380.Sh DIAGNOSTICS
381Various, most of them are self-explanatory.
382.Pp
383.Dl XXXXX filesystem is not available
384.Pp
385The kernel does not support the respective filesystem type.
386Note that
387support for a particular filesystem might be provided either on a static
388(kernel compile-time), or dynamic basis (loaded as a kernel module by
389.Xr kldload 8 ) .
390Normally,
391.Nm
392or its subprocesses attempt to dynamically load a filesystem module if
393it has not been configured statically, using
394.Xr vfsload 3 .
395In this case, the above error message can also mean that you did not
396have permission to load the module.
397.Sh SEE ALSO
398.Xr df 1 ,
399.Xr lsvfs 1 ,
400.Xr mount 2 ,
401.Xr vfsload 3 ,
402.Xr devtab 5 ,
403.Xr fstab 5 ,
404.Xr UFS 5 ,
405.Xr automount 8 ,
406.Xr automountd 8 ,
407.Xr autounmountd 8 ,
408.Xr kldload 8 ,
409.Xr mount_cd9660 8 ,
410.Xr mount_devfs 8 ,
411.Xr mount_ext2fs 8 ,
412.Xr mount_hammer 8 ,
413.Xr mount_hammer2 8 ,
414.Xr mount_hpfs 8 ,
415.Xr mount_mfs 8 ,
416.Xr mount_msdos 8 ,
417.Xr mount_nfs 8 ,
418.Xr mount_ntfs 8 ,
419.Xr mount_null 8 ,
420.Xr mount_procfs 8 ,
421.Xr mount_smbfs 8 ,
422.Xr mount_std 8 ,
423.Xr mount_tmpfs 8 ,
424.Xr mount_udf 8 ,
425.Xr sysctl 8 ,
426.Xr umount 8
427.Sh HISTORY
428A
429.Nm
430utility appeared in
431.At v1 .
432.Sh CAVEATS
433After a successful
434.Nm ,
435the permissions on the original mount point determine if
436.Pa ..\&
437is accessible from the mounted file system.
438The minimum permissions for
439the mount point for traversal across the mount point in both
440directions to be possible for all users is 0111 (execute for all).
441.Sh BUGS
442It is possible for a corrupted file system to cause a crash.
443