xref: /openbsd/sbin/mount/mount.8 (revision d485f761)
1.\"	$OpenBSD: mount.8,v 1.32 2001/08/13 21:28:35 pvalchev Exp $
2.\"	$NetBSD: mount.8,v 1.11 1995/07/12 06:23:21 cgd Exp $
3.\"
4.\" Copyright (c) 1980, 1989, 1991, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"	This product includes software developed by the University of
18.\"	California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\"    may be used to endorse or promote products derived from this software
21.\"    without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\"     @(#)mount.8	8.7 (Berkeley) 3/27/94
36.\"
37.Dd March 27, 1994
38.Dt MOUNT 8
39.Os
40.Sh NAME
41.Nm mount
42.Nd mount file systems
43.Sh SYNOPSIS
44.Nm mount
45.Op Fl Aadfruvw
46.Op Fl t Ar type
47.Nm mount
48.Op Fl dfruvw
49.Ar special | node
50.Nm mount
51.Op Fl dfruvw
52.Op Fl o Ar options
53.Op Fl t Ar type
54.Ar special node
55.Sh DESCRIPTION
56The
57.Nm
58command invokes a filesystem-specific program to prepare
59and graft the
60.Ar special
61device or remote node (rhost:path) on to the file system
62tree 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 mount ,
75this list is printed.
76.Pp
77A mount point
78.Ar node
79must be an existing directory for a mount to succeed
80.Po
81except in the special case of
82.Pa / ,
83of course
84.Pc .
85Only the superuser may mount filesystems unless
86.Va kern.usermount
87is nonzero
88.Po
89see
90.Xr sysctl 8
91.Pc .
92.Pp
93The options are as follows:
94.Bl -tag -width Ds
95.It Fl A
96Causes
97.Nm
98to try to mount all of the file systems listed in the
99.Xr fstab 5
100table except those for which the
101.Dq noauto
102option is specified.
103.It Fl a
104Similar to the
105.Fl A
106flag, except that if a file system (other than the root file system)
107appears to be already mounted,
108.Nm
109will not try to mount it again.
110.Nm
111assumes that a file system is already mounted if a file system with
112the same type is mounted on the given mount point.
113More stringent checks are not possible because some file system types
114report strange values for the mounted-from device for mounted file
115systems.
116.It Fl d
117Causes everything to be done except for the invocation of
118the filesystem-specific program.
119This option is useful in conjunction with the
120.Fl v
121flag to
122determine what the
123.Nm
124command is trying to do.
125.It Fl f
126Either force mounting of dirty filesystems or, in the case of a
127downgrade from read-write to read-only operation, the revocation of
128opened files with write access.
129.It Fl o Ar options
130Options are specified with a
131.Fl o
132flag followed by a comma separated string of options.
133Available options are as follows:
134.Bl -tag -width Ds
135.It async
136All
137.Tn I/O
138to the file system should be done asynchronously.
139This is a
140.Em dangerous
141flag to set since it does not guarantee to keep a consistent
142file system structure on the disk.
143You should not use this flag
144unless you are prepared to recreate the file system should your
145system crash.
146The most common use of this flag is to speed up
147.Xr restore 8
148where it can give a factor of two speed increase.
149.It softdep
150(FFS only.)
151Mount the filesystem using soft dependencies.
152Instead of metadata being written immediately, it is written in an ordered
153fashion to keep the on-disk state of the filesystem consistent.
154This results in significant speedups for file create/delete operations.
155This option will be ignored when using the
156.Fl u
157flag and a filesystem is already mounted read/write.
158It requires
159.Cm option FFS_SOFTUPDATES
160to be enabled in the running kernel.
161.It force
162The same as
163.Fl f ;
164forces the revocation of write access when trying to downgrade
165a filesystem mount status from read-write to read-only.
166.It noatime
167Do not update atime on files in the system unless the mtime or ctime
168is being changed as well.
169This option is useful for laptops and news servers where one does
170not want the extra disk activity associated with updating the atime.
171.It noaccesstime
172Synonym for noatime provided for compatibility with
173other operating systems.
174.It nodev
175Do not interpret character or block special devices on the file system.
176This option is useful for a server that has file systems containing
177special devices for architectures other than its own.
178.It noexec
179Do not allow execution of any binaries on the mounted file system.
180This option is useful for a server that has file systems containing
181binaries for architectures other than its own.
182.It nosuid
183Do not allow set-user-identifier or set-group-identifier bits to take effect.
184.It rdonly
185The same as
186.Fl r ;
187mount the file system read-only (even the superuser may not write it).
188.It sync
189All
190.Tn I/O
191to the file system should be done synchronously.
192.It update
193The same as
194.Fl u ;
195indicate that the status of an already mounted file system should be changed.
196.It union
197Causes the namespace at the mount point to appear as the union
198of the mounted filesystem root and the existing directory.
199Lookups will be done in the mounted filesystem first.
200If those operations fail due to a non-existent file the underlying
201directory is then accessed.
202All creates are done in the mounted filesystem.
203.El
204.Pp
205Any additional options specific to a given filesystem type (see the
206.Fl t
207option) may be passed as a comma separated list; these options are
208distinguished by a leading
209.Dq \&-
210(dash).
211Options that take a value are specified using the syntax -option=value.
212For example, the
213.Nm
214command:
215.Bd -literal -offset indent
216mount -t mfs -o nosuid,-N,-s=4000 /dev/dk0b /tmp
217.Ed
218.Pp
219causes
220.Nm
221to execute the equivalent of:
222.Bd -literal -offset indent
223/sbin/mount_mfs -o nosuid -N -s 4000 /dev/dk0b /tmp
224.Ed
225.It Fl r
226The file system is to be mounted read-only.
227Mount the file system read-only (even the superuser may not write it).
228The same as the
229.Dq rdonly
230argument to the
231.Fl o
232option.
233.It Fl t Ar type
234The argument following the
235.Fl t
236is used to indicate the file system type.
237The type
238.Ar ffs
239is the default.
240The
241.Fl t
242option can be used
243to indicate that the actions should only be taken on
244filesystems of the specified type.
245More than one type may be specified in a comma separated list.
246The list of filesystem types can be prefixed with
247.Dq no
248to specify the filesystem types for which action should
249.Em not
250be taken.
251For example, the
252.Nm
253command:
254.Bd -literal -offset indent
255mount -a -t nonfs,mfs
256.Ed
257.Pp
258mounts all filesystems except those of type
259.Tn NFS
260and
261.Tn MFS .
262.Pp
263.Nm
264will attempt to execute a program in
265.Pa /sbin/mount_ Ns Em XXX
266where
267.Em XXX
268is replaced by the type name.
269For example, nfs filesystems are mounted by the program
270.Pa /sbin/mount_nfs .
271.It Fl u
272The
273.Fl u
274flag indicates that the status of an already mounted file
275system should be changed.
276Any of the options discussed above (the
277.Fl o
278option)
279may be changed;
280also a file system can be changed from read-only to read-write
281or vice versa.
282An attempt to change from read-write to read-only will fail if any
283files on the filesystem are currently open for writing unless the
284.Fl f
285flag is also specified.
286The filesystem options are set to those specified in the command line.
287The options set in the
288.Xr fstab 5
289table are ignored.
290.It Fl v
291Verbose mode.
292.It Fl w
293The file system object is to be read and write.
294.El
295.Pp
296The options specific to the various file system types are
297described in the manual pages for those file systems'
298.Nm mount_XXX
299commands.
300For instance, the options specific to Berkeley
301Fast File Systems are described in the
302.Xr mount_ffs 8
303manual page.
304.Sh EXAMPLES
305.Bd -literal
306mount -t cd9660 -r /dev/cd0a /mnt/cdrom
307mount -t msdos /dev/fd0a /mnt/floppy
308mount host:/path/name /mnt/nfs
309.Ed
310.Sh FILES
311.Bl -tag -width /etc/fstab -compact
312.It Pa /etc/fstab
313file system table
314.El
315.Sh SEE ALSO
316.Xr mount 2 ,
317.Xr fstab 5 ,
318.Xr mount_ados 8 ,
319.Xr mount_cd9660 8 ,
320.Xr mount_ext2fs 8 ,
321.Xr mount_fdesc 8 ,
322.Xr mount_ffs 8 ,
323.Xr mount_kernfs 8 ,
324.Xr mount_mfs 8 ,
325.Xr mount_msdos 8 ,
326.Xr mount_nfs 8 ,
327.Xr mount_null 8 ,
328.Xr mount_portal 8 ,
329.Xr mount_procfs 8 ,
330.Xr mount_umap 8 ,
331.Xr mount_union 8 ,
332.Xr mount_xfs 8 ,
333.Xr sysctl 8 ,
334.Xr umount 8
335.Sh HISTORY
336A
337.Nm
338command appeared in
339.At v6 .
340