xref: /freebsd/sbin/mount/mount.8 (revision d2387d42b8da231a5b95cbc313825fb2aadf26f6)
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 April 7, 2003
36.Dt MOUNT 8
37.Os
38.Sh NAME
39.Nm mount
40.Nd mount file systems
41.Sh SYNOPSIS
42.Nm
43.Op Fl adfpruvw
44.Op Fl F Ar fstab
45.Op Fl o Ar options
46.Op Fl t Ar ufs | external_type
47.Nm
48.Op Fl dfpruvw
49.Ar special | node
50.Nm
51.Op Fl dfpruvw
52.Op Fl o Ar options
53.Op Fl t Ar ufs | external_type
54.Ar special node
55.Sh DESCRIPTION
56The
57.Nm
58utility calls the
59.Xr mount 2
60system call to prepare and graft a
61.Ar "special device"
62or the remote node (rhost:path) on to the file system tree at the point
63.Ar node .
64If either
65.Ar special
66or
67.Ar node
68are not provided, the appropriate information is taken from the
69.Xr fstab 5
70file.
71.Pp
72The system maintains a list of currently mounted file systems.
73If no arguments are given to
74.Nm ,
75this list is printed.
76.Pp
77The options are as follows:
78.Bl -tag -width indent
79.It Fl a
80All the file systems described in
81.Xr fstab 5
82are mounted.
83Exceptions are those marked as
84.Dq noauto ,
85excluded by the
86.Fl t
87flag (see below), or if they are already mounted (except the
88root file system which is always remounted to preserve
89traditional single user mode behavior).
90.It Fl d
91Causes everything to be done except for the actual system call.
92This option is useful in conjunction with the
93.Fl v
94flag to
95determine what the
96.Nm
97command is trying to do.
98.It Fl F Ar fstab
99Specify the
100.Pa fstab
101file to use.
102.It Fl f
103Forces the revocation of write access when trying to downgrade
104a file system mount status from read-write to read-only.
105Also
106forces the R/W mount of an unclean file system (dangerous; use with
107caution).
108.It Fl o
109Options are specified with a
110.Fl o
111flag followed by a comma separated string of options.
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 acls
117Enable Access Control Lists, or ACLS, which can be customized via the
118.Xr setfacl 1
119and
120.Xr getfacl 1
121commands.
122.It Cm async
123All
124.Tn I/O
125to the file system should be done asynchronously.
126This is a
127.Em dangerous
128flag to set,
129and should not be used unless you are prepared to recreate the file
130system should your system crash.
131.It Cm current
132When used with the
133.Fl u
134flag, this is the same as specifying the options currently in effect for
135the mounted file system.
136.It Cm force
137The same as
138.Fl f ;
139forces the revocation of write access when trying to downgrade
140a file system mount status from read-write to read-only.
141Also
142forces the R/W mount of an unclean file system (dangerous; use with caution).
143.It Cm fstab
144When used with the
145.Fl u
146flag, this is the same as specifying all the options listed in the
147.Xr fstab 5
148file for the file system.
149.It Cm multilabel
150Enable multi-label Mandatory Access Control, or MAC, on the specified file
151system.
152If the file system supports multilabel operation, individual labels will
153be maintained for each object in the file system, rather than using a
154single label for all obejcts.
155An alternative to
156.Em -l
157flag in
158.Xr tunefs 8 .
159See
160.Xr mac 4
161for more information, which cause the multilabel mount flag to be set
162automatically at mount-time.
163.It Cm noasync
164Metadata I/O should be done synchronously, while data I/O should be done
165asynchronously.
166This is the default.
167.It Cm noatime
168Do not update the file access time when reading from a file.
169This option
170is useful on file systems where there are large numbers of files and
171performance is more critical than updating the file access time (which is
172rarely ever important).
173This option is currently only supported on local file systems.
174.It Cm noauto
175This file system should be skipped when
176.Nm
177is run with the
178.Fl a
179flag.
180.It Cm noclusterr
181Disable read clustering.
182.It Cm noclusterw
183Disable write clustering.
184.It Cm nodev
185Do not interpret character or block special devices on the file system.
186This option is useful for a server that has file systems containing
187special devices for architectures other than its own.
188This option is set automatically when the user does not have super-user
189privileges.
190.It Cm noexec
191Do not allow execution of any binaries on the mounted file system.
192This option is useful for a server that has file systems containing
193binaries for architectures other than its own.
194.It Cm nosuid
195Do not allow set-user-identifier or set-group-identifier bits to take effect.
196Note: this option is worthless if a public available suid or sgid
197wrapper like
198.Xr suidperl 1
199is installed on your system.
200It is set automatically when the user does not have super-user privileges.
201.It Cm nosymfollow
202Do not follow symlinks
203on the mounted file system.
204.It Cm ro
205The same as
206.Fl r ;
207mount the file system read-only (even the super-user may not write it).
208.It Cm sync
209All
210.Tn I/O
211to the file system should be done synchronously.
212.It Cm snapshot
213This option allows a snapshot of the specified file system to be taken.
214The
215.Fl u
216flag is required with this option.
217Note that snapshot files must be created in the file system that is being
218snapshotted.
219You may create up to 20 snapshots per file system.
220Active snapshots are recorded in the superblock, so they persist across unmount
221and remount operations and across system reboots.
222When you are done with a snapshot, it can be removed with the
223.Xr rm 1
224command.
225Snapshots may be removed in any order, however you may not get back all the
226space contained in the snapshot as another snapshot may claim some of the blocks
227that it is releasing.
228Note that the schg flag is set on snapshots to ensure that not even the root
229user can write to them.
230The unlink command makes an exception for snapshot files in that it allows them
231to be removed even though they have the schg flag set, so it is not necessary to
232clear the schg flag before removing a snapshot file.
233.Pp
234Once you have taken a snapshot, there are three interesting things that you can
235do with it:
236.Pp
237.Bl -enum -compact
238.It
239Run
240.Xr fsck 8
241on the snapshot file.
242Assuming that the file system was clean when it was mounted, you should always
243get a clean (and unchanging) result from running fsck on the snapshot.
244This is essentially what the background fsck process does.
245.Pp
246.It
247Run
248.Xr dump 8
249on the snapshot.
250You will get a dump that is consistent with the file system as of the timestamp
251of the snapshot.
252.Pp
253.It
254Mount the snapshot as a frozen image of the file system.
255To mount the snapshot
256.Pa /var/snapshot/snap1 :
257.Bd -literal
258mdconfig -a -t vnode -f /var/snapshot/snap1 -u 4
259mount -r /dev/md4 /mnt
260.Ed
261.Pp
262You can now cruise around your frozen
263.Pa /var
264file system at
265.Pa /mnt .
266Everything will be in the same state that it was at the time the snapshot was
267taken.
268The one exception is that any earlier snapshots will appear as zero length
269files.
270When you are done with the mounted snapshot:
271.Bd -literal
272umount /mnt
273mdconfig -d -u 4
274.Ed
275.Pp
276Further details can be found in the file at
277.Pa /usr/src/sys/ufs/ffs/README.snapshot .
278.El
279.It Cm suiddir
280A directory on the mounted file system will respond to the SUID bit
281being set, by setting the owner of any new files to be the same
282as the owner of the directory.
283New directories will inherit the bit from their parents.
284Execute bits are removed from
285the file, and it will not be given to root.
286.Pp
287This feature is designed for use on fileservers serving PC users via
288ftp, SAMBA, or netatalk.
289It provides security holes for shell users and as
290such should not be used on shell machines, especially on home directories.
291This option requires the SUIDDIR
292option in the kernel to work.
293Only UFS file systems support this option.
294See
295.Xr chmod 2
296for more information.
297.It Cm update
298The same as
299.Fl u ;
300indicate that the status of an already mounted file system should be changed.
301.It Cm union
302Causes the namespace at the mount point to appear as the union
303of the mounted file system root and the existing directory.
304Lookups will be done in the mounted file system first.
305If those operations fail due to a non-existent file the underlying
306directory is then accessed.
307All creates are done in the mounted file system.
308.El
309.Pp
310Any additional options specific to a file system type that is not
311one of the internally known types (see the
312.Fl t
313option) may be passed as a comma separated list; these options are
314distinguished by a leading
315.Dq \&-
316(dash).
317Options that take a value are specified using the syntax -option=value.
318For example, the
319.Nm
320command:
321.Bd -literal -offset indent
322mount -t unionfs -o -b /sys $HOME/sys
323.Ed
324.Pp
325causes
326.Nm
327to execute the equivalent of:
328.Bd -literal -offset indent
329/sbin/mount_unionfs -b /sys $HOME/sys
330.Ed
331.Pp
332Additional options specific to file system types
333which are not internally known
334(see the description of the
335.Fl t
336option below)
337may be described in the manual pages for the associated
338.Pa /sbin/mount_ Ns Sy XXX
339utilities.
340.It Fl p
341Print mount information in
342.Xr fstab 5
343format.
344Implies also the
345.Fl v
346option.
347.It Fl r
348The file system is to be mounted read-only.
349Mount the file system read-only (even the super-user may not write it).
350The same as the
351.Cm ro
352argument to the
353.Fl o
354option.
355.It Fl t Ar ufs | external_type
356The argument following the
357.Fl t
358is used to indicate the file system type.
359The type
360.Ar ufs
361is the default.
362The
363.Fl t
364option can be used
365to indicate that the actions should only be taken on
366file systems of the specified type.
367More than one type may be specified in a comma separated list.
368The list of file system types can be prefixed with
369.Dq no
370to specify the file system types for which action should
371.Em not
372be taken.
373For example, the
374.Nm
375command:
376.Bd -literal -offset indent
377mount -a -t nonfs,nullfs
378.Ed
379.Pp
380mounts all file systems except those of type
381.Tn NFS
382and
383.Tn NULLFS .
384.Pp
385If the type is not one of the internally known types,
386.Nm
387will attempt to execute a program in
388.Pa /sbin/mount_ Ns Sy XXX
389where
390.Sy XXX
391is replaced by the type name.
392For example, nfs file systems are mounted by the program
393.Pa /sbin/mount_nfs .
394.Pp
395Most file systems will be dynamically loaded by the kernel
396if not already present, and if the kernel module is available.
397.It Fl u
398The
399.Fl u
400flag indicates that the status of an already mounted file
401system should be changed.
402Any of the options discussed above (the
403.Fl o
404option)
405may be changed;
406also a file system can be changed from read-only to read-write
407or vice versa.
408An attempt to change from read-write to read-only will fail if any
409files on the file system are currently open for writing unless the
410.Fl f
411flag is also specified.
412The set of options is determined by applying the options specified
413in the argument to
414.Fl o
415and finally applying the
416.Fl r
417or
418.Fl w
419option.
420.It Fl v
421Verbose mode.
422.It Fl w
423The file system object is to be read and write.
424.El
425.Sh DIAGNOSTICS
426Various, most of them are self-explanatory.
427.Pp
428.Dl XXXXX file system is not available
429.Pp
430The kernel does not support the respective file system type.
431Note that
432support for a particular file system might be provided either on a static
433(kernel compile-time), or dynamic basis (loaded as a kernel module by
434.Xr kldload 8 ) .
435.Sh ENVIRONMENT
436.Bl -tag -width ".Ev PATH_FSTAB"
437.It Ev PATH_FSTAB
438If the environment variable
439.Ev PATH_FSTAB
440is set, all operations are performed against the specified file.
441.Ev PATH_FSTAB
442will not be honored if the process environment or memory address space is
443considered
444.Dq tainted .
445(See
446.Xr issetugid 2
447for more information.)
448.El
449.Sh FILES
450.Bl -tag -width /etc/fstab -compact
451.It Pa /etc/fstab
452file system table
453.El
454.Sh SEE ALSO
455.Xr getfacl 1 ,
456.Xr setfacl 1 ,
457.Xr mount 2 ,
458.Xr acl 3 ,
459.Xr mac 4 ,
460.Xr fstab 5 ,
461.Xr kldload 8 ,
462.Xr mount_cd9660 8 ,
463.Xr mount_devfs 8 ,
464.Xr mount_ext2fs 8 ,
465.Xr mount_fdescfs 8 ,
466.Xr mount_hpfs 8 ,
467.Xr mount_linprocfs 8 ,
468.Xr mount_msdosfs 8 ,
469.Xr mount_nfs 8 ,
470.Xr mount_ntfs 8 ,
471.Xr mount_nullfs 8 ,
472.Xr mount_nwfs 8 ,
473.Xr mount_portalfs 8 ,
474.Xr mount_procfs 8 ,
475.Xr mount_smbfs 8 ,
476.Xr mount_std 8 ,
477.Xr mount_udf 8 ,
478.Xr mount_umapfs 8 ,
479.Xr mount_unionfs 8 ,
480.Xr umount 8
481.Sh BUGS
482It is possible for a corrupted file system to cause a crash.
483.Sh CAVEATS
484After a successful
485.Nm ,
486the permissions on the original mount point determine if
487.Pa ..\&
488is accessible from the mounted file system.
489The minimum permissions for
490the mount point for traversal across the mount point in both
491directions to be possible for all users is 0111 (execute for all).
492.Sh HISTORY
493A
494.Nm
495utility appeared in
496.At v1 .
497