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