xref: /freebsd/sbin/mount/mount.8 (revision f9218d3d4fd34f082473b3a021c6d4d109fb47cf)
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 file systems
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 file system 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 file systems.
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 file systems 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 file system 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 file system mount status from read-write to read-only.
99Also
100forces the R/W mount of an unclean file system (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 file system 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 file system.
124.It Cm force
125The same as
126.Fl f ;
127forces the revocation of write access when trying to downgrade
128a file system mount status from read-write to read-only.
129Also
130forces the R/W mount of an unclean file system (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 file system.
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 file systems 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 file systems.
148.It Cm noauto
149This file system 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 file system.
160This option is useful for a server that has file systems containing
161special devices for architectures other than its own.
162This option is set automatically when the user does not have super-user
163privileges.
164.It Cm noexec
165Do not allow execution of any binaries on the mounted file system.
166This option is useful for a server that has file systems containing
167binaries for architectures other than its own.
168.It Cm nosuid
169Do not allow set-user-identifier or set-group-identifier bits to take effect.
170Note: this option is worthless if a public available suid or sgid
171wrapper like
172.Xr suidperl 1
173is installed on your system.
174It is set automatically when the user does not have super-user privileges.
175.It Cm nosymfollow
176Do not follow symlinks
177on the mounted file system.
178.It Cm rdonly
179The same as
180.Fl r ;
181mount the file system read-only (even the super-user may not write it).
182.It Cm sync
183All
184.Tn I/O
185to the file system should be done synchronously.
186.It Cm snapshot
187This option allows a snapshot of the specified file system to be taken.
188The
189.Fl u
190flag is required with this option.
191Note that snapshot files must be created in the file system that is being
192snapshotted.
193You may create up to 20 snapshots per file system.
194Active snapshots are recorded in the superblock, so they persist across unmount
195and remount operations and across system reboots.
196When you are done with a snapshot, it can be removed with the
197.Xr rm 1
198command.
199Snapshots may be removed in any order, however you may not get back all the
200space contained in the snapshot as another snapshot may claim some of the blocks
201that it is releasing.
202Note that the schg flag is set on snapshots to ensure that not even the root
203user can write to them.
204The unlink command makes an exception for snapshot files in that it allows them
205to be removed even though they have the schg flag set, so it is not necessary to
206clear the schg flag before removing a snapshot file.
207.Pp
208Once you have taken a snapshot, there are three interesting things that you can
209do with it:
210.Pp
211.Bl -enum -compact
212.It
213Run
214.Xr fsck 8
215on the snapshot file.
216Assuming that the file system was clean when it was mounted, you should always
217get a clean (and unchanging) result from running fsck on the snapshot.
218This is essentially what the background fsck process does.
219.Pp
220.It
221Run
222.Xr dump 8
223on the snapshot.
224You will get a dump that is consistent with the file system as of the timestamp
225of the snapshot.
226.Pp
227.It
228Mount the snapshot as a frozen image of the file system.
229To mount the snapshot
230.Pa /var/snapshot/snap1 :
231.Bd -literal
232mdconfig -a -t vnode -f /var/snapshot/snap1 -u 4
233mount -r /dev/md4 /mnt
234.Ed
235.Pp
236You can now cruise around your frozen
237.Pa /var
238file system at
239.Pa /mnt .
240Everything will be in the same state that it was at the time the snapshot was
241taken.
242The one exception is that any earlier snapshots will appear as zero length
243files.
244When you are done with the mounted snapshot:
245.Bd -literal
246umount /mnt
247mdconfig -d -u 4
248.Ed
249.Pp
250Further details can be found in the file at
251.Pa /usr/src/sys/ufs/ffs/README.snapshot .
252.El
253.It Cm suiddir
254A directory on the mounted file system will respond to the SUID bit
255being set, by setting the owner of any new files to be the same
256as the owner of the directory.
257New directories will inherit the bit from their parents.
258Execute bits are removed from
259the file, and it will not be given to root.
260.Pp
261This feature is designed for use on fileservers serving PC users via
262ftp, SAMBA, or netatalk.
263It provides security holes for shell users and as
264such should not be used on shell machines, especially on home directories.
265This option requires the SUIDDIR
266option in the kernel to work.
267Only UFS file systems support this option.
268See
269.Xr chmod 2
270for more information.
271.It Cm update
272The same as
273.Fl u ;
274indicate that the status of an already mounted file system should be changed.
275.It Cm union
276Causes the namespace at the mount point to appear as the union
277of the mounted file system root and the existing directory.
278Lookups will be done in the mounted file system first.
279If those operations fail due to a non-existent file the underlying
280directory is then accessed.
281All creates are done in the mounted file system.
282.El
283.Pp
284Any additional options specific to a file system type that is not
285one of the internally known types (see the
286.Fl t
287option) may be passed as a comma separated list; these options are
288distinguished by a leading
289.Dq \&-
290(dash).
291Options that take a value are specified using the syntax -option=value.
292For example, the
293.Nm
294command:
295.Bd -literal -offset indent
296mount -t unionfs -o -b /sys $HOME/sys
297.Ed
298.Pp
299causes
300.Nm
301to execute the equivalent of:
302.Bd -literal -offset indent
303/sbin/mount_unionfs -b /sys $HOME/sys
304.Ed
305.Pp
306Additional options specific to file system types
307which are not internally known
308(see the description of the
309.Fl t
310option below)
311may be described in the manual pages for the associated
312.Pa /sbin/mount_ Ns Sy XXX
313utilities.
314.It Fl p
315Print mount information in
316.Xr fstab 5
317format.
318Implies also the
319.Fl v
320option.
321.It Fl r
322The file system is to be mounted read-only.
323Mount the file system read-only (even the super-user may not write it).
324The same as the
325.Cm rdonly
326argument to the
327.Fl o
328option.
329.It Fl t Ar ufs | external_type
330The argument following the
331.Fl t
332is used to indicate the file system type.
333The type
334.Ar ufs
335is the default.
336The
337.Fl t
338option can be used
339to indicate that the actions should only be taken on
340file systems of the specified type.
341More than one type may be specified in a comma separated list.
342The list of file system types can be prefixed with
343.Dq no
344to specify the file system types for which action should
345.Em not
346be taken.
347For example, the
348.Nm
349command:
350.Bd -literal -offset indent
351mount -a -t nonfs,nullfs
352.Ed
353.Pp
354mounts all file systems except those of type
355.Tn NFS
356and
357.Tn NULLFS .
358.Pp
359If the type is not one of the internally known types,
360.Nm
361will attempt to execute a program in
362.Pa /sbin/mount_ Ns Sy XXX
363where
364.Sy XXX
365is replaced by the type name.
366For example, nfs file systems are mounted by the program
367.Pa /sbin/mount_nfs .
368.Pp
369Most file systems will be dynamically loaded by the kernel
370if not already present, and if the kernel module is available.
371.It Fl u
372The
373.Fl u
374flag indicates that the status of an already mounted file
375system should be changed.
376Any of the options discussed above (the
377.Fl o
378option)
379may be changed;
380also a file system can be changed from read-only to read-write
381or vice versa.
382An attempt to change from read-write to read-only will fail if any
383files on the file system are currently open for writing unless the
384.Fl f
385flag is also specified.
386The set of options is determined by applying the options specified
387in the argument to
388.Fl o
389and finally applying the
390.Fl r
391or
392.Fl w
393option.
394.It Fl v
395Verbose mode.
396.It Fl w
397The file system object is to be read and write.
398.El
399.Sh DIAGNOSTICS
400Various, most of them are self-explanatory.
401.Pp
402.Dl XXXXX file system is not available
403.Pp
404The kernel does not support the respective file system type.
405Note that
406support for a particular file system might be provided either on a static
407(kernel compile-time), or dynamic basis (loaded as a kernel module by
408.Xr kldload 8 ) .
409.Sh FILES
410.Bl -tag -width /etc/fstab -compact
411.It Pa /etc/fstab
412file system table
413.El
414.Sh SEE ALSO
415.Xr mount 2 ,
416.Xr fstab 5 ,
417.Xr kldload 8 ,
418.Xr mount_cd9660 8 ,
419.Xr mount_devfs 8 ,
420.Xr mount_ext2fs 8 ,
421.Xr mount_fdescfs 8 ,
422.Xr mount_hpfs 8 ,
423.Xr mount_linprocfs 8 ,
424.Xr mount_msdosfs 8 ,
425.Xr mount_nfs 8 ,
426.Xr mount_ntfs 8 ,
427.Xr mount_nullfs 8 ,
428.Xr mount_nwfs 8 ,
429.Xr mount_portalfs 8 ,
430.Xr mount_procfs 8 ,
431.Xr mount_smbfs 8 ,
432.Xr mount_std 8 ,
433.Xr mount_udf 8 ,
434.Xr mount_umapfs 8 ,
435.Xr mount_unionfs 8 ,
436.Xr umount 8
437.Sh BUGS
438It is possible for a corrupted file system to cause a crash.
439.Sh CAVEATS
440After a successful
441.Nm ,
442the permissions on the original mount point determine if
443.Pa ..\&
444is accessible from the mounted file system.
445The minimum permissions for
446the mount point for traversal across the mount point in both
447directions to be possible for all users is 0111 (execute for all).
448.Sh HISTORY
449A
450.Nm
451utility appeared in
452.At v1 .
453