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