xref: /openbsd/sbin/mount/mount.8 (revision 1ef0d710)
1*1ef0d710Smillert.\"	$OpenBSD: mount.8,v 1.41 2003/06/02 20:06:15 millert Exp $
2df930be7Sderaadt.\"	$NetBSD: mount.8,v 1.11 1995/07/12 06:23:21 cgd Exp $
3df930be7Sderaadt.\"
4df930be7Sderaadt.\" Copyright (c) 1980, 1989, 1991, 1993
5df930be7Sderaadt.\"	The Regents of the University of California.  All rights reserved.
6df930be7Sderaadt.\"
7df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without
8df930be7Sderaadt.\" modification, are permitted provided that the following conditions
9df930be7Sderaadt.\" are met:
10df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright
11df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer.
12df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
13df930be7Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
14df930be7Sderaadt.\"    documentation and/or other materials provided with the distribution.
15*1ef0d710Smillert.\" 3. Neither the name of the University nor the names of its contributors
16df930be7Sderaadt.\"    may be used to endorse or promote products derived from this software
17df930be7Sderaadt.\"    without specific prior written permission.
18df930be7Sderaadt.\"
19df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20df930be7Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21df930be7Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22df930be7Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23df930be7Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24df930be7Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25df930be7Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26df930be7Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27df930be7Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28df930be7Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29df930be7Sderaadt.\" SUCH DAMAGE.
30df930be7Sderaadt.\"
31df930be7Sderaadt.\"     @(#)mount.8	8.7 (Berkeley) 3/27/94
32df930be7Sderaadt.\"
33df930be7Sderaadt.Dd March 27, 1994
34df930be7Sderaadt.Dt MOUNT 8
35fc8533a3Saaron.Os
36df930be7Sderaadt.Sh NAME
37df930be7Sderaadt.Nm mount
38df930be7Sderaadt.Nd mount file systems
39df930be7Sderaadt.Sh SYNOPSIS
407349792aSaaron.Nm mount
41df930be7Sderaadt.Op Fl Aadfruvw
42df930be7Sderaadt.Op Fl t Ar type
437349792aSaaron.Nm mount
44df930be7Sderaadt.Op Fl dfruvw
45df930be7Sderaadt.Ar special | node
467349792aSaaron.Nm mount
47df930be7Sderaadt.Op Fl dfruvw
48df930be7Sderaadt.Op Fl o Ar options
49df930be7Sderaadt.Op Fl t Ar type
50df930be7Sderaadt.Ar special node
51df930be7Sderaadt.Sh DESCRIPTION
52df930be7SderaadtThe
5358aefd4bSaaron.Nm
5405d692a5Steducommand invokes a file system specific program to prepare
55df930be7Sderaadtand graft the
56df930be7Sderaadt.Ar special
57df930be7Sderaadtdevice or remote node (rhost:path) on to the file system
58df930be7Sderaadttree at the point
59df930be7Sderaadt.Ar node .
60df930be7SderaadtIf either
61df930be7Sderaadt.Ar special
62df930be7Sderaadtor
63df930be7Sderaadt.Ar node
64df930be7Sderaadtare not provided, the appropriate information is taken from the
65df930be7Sderaadt.Xr fstab 5
66df930be7Sderaadtfile.
67df930be7Sderaadt.Pp
68ba98c64dSespieFor disk partitions, the
69ba98c64dSespie.Ar special
70ba98c64dSespiedevice must correspond to a partition registered in the
71ba98c64dSespie.Xr disklabel 5 .
72ba98c64dSespie.Pp
73df930be7SderaadtThe system maintains a list of currently mounted file systems.
74df930be7SderaadtIf no arguments are given to
75df930be7Sderaadt.Nm mount ,
76df930be7Sderaadtthis list is printed.
77df930be7Sderaadt.Pp
78581d34a0SpjanzenA mount point
79581d34a0Spjanzen.Ar node
80581d34a0Spjanzenmust be an existing directory for a mount to succeed
81581d34a0Spjanzen.Po
82581d34a0Spjanzenexcept in the special case of
83581d34a0Spjanzen.Pa / ,
84581d34a0Spjanzenof course
85581d34a0Spjanzen.Pc .
86581d34a0SpjanzenOnly the superuser may mount file systems unless
87581d34a0Spjanzen.Va kern.usermount
88581d34a0Spjanzenis nonzero
89581d34a0Spjanzen.Po
90581d34a0Spjanzensee
91581d34a0Spjanzen.Xr sysctl 8
92581d34a0Spjanzen.Pc .
93581d34a0Spjanzen.Pp
94f1ba3473SaaronThe options are as follows:
95f1ba3473Saaron.Bl -tag -width Ds
96df930be7Sderaadt.It Fl A
97df930be7SderaadtCauses
9858aefd4bSaaron.Nm
99df930be7Sderaadtto try to mount all of the file systems listed in the
100ffbe7eb8Sderaadt.Xr fstab 5
101df930be7Sderaadttable except those for which the
102df930be7Sderaadt.Dq noauto
103df930be7Sderaadtoption is specified.
104df930be7Sderaadt.It Fl a
105df930be7SderaadtSimilar to the
106df930be7Sderaadt.Fl A
107df930be7Sderaadtflag, except that if a file system (other than the root file system)
108df930be7Sderaadtappears to be already mounted,
10958aefd4bSaaron.Nm
110df930be7Sderaadtwill not try to mount it again.
11158aefd4bSaaron.Nm
112df930be7Sderaadtassumes that a file system is already mounted if a file system with
113df930be7Sderaadtthe same type is mounted on the given mount point.
114df930be7SderaadtMore stringent checks are not possible because some file system types
115df930be7Sderaadtreport strange values for the mounted-from device for mounted file
116df930be7Sderaadtsystems.
117df930be7Sderaadt.It Fl d
118df930be7SderaadtCauses everything to be done except for the invocation of
11905d692a5Steduthe file system specific program.
120df930be7SderaadtThis option is useful in conjunction with the
121df930be7Sderaadt.Fl v
122df930be7Sderaadtflag to
123df930be7Sderaadtdetermine what the
12458aefd4bSaaron.Nm
125df930be7Sderaadtcommand is trying to do.
126df930be7Sderaadt.It Fl f
127e63188c1SpvalchevEither force mounting of dirty file systems or, in the case of a
128bd182408Sniklasdowngrade from read-write to read-only operation, the revocation of
129bd182408Sniklasopened files with write access.
130b24688ffSderaadt.It Fl o Ar options
131df930be7SderaadtOptions are specified with a
132df930be7Sderaadt.Fl o
133df930be7Sderaadtflag followed by a comma separated string of options.
134f1ba3473SaaronAvailable options are as follows:
135f1ba3473Saaron.Bl -tag -width Ds
136df930be7Sderaadt.It async
137df930be7SderaadtAll
138df930be7Sderaadt.Tn I/O
139df930be7Sderaadtto the file system should be done asynchronously.
140df930be7SderaadtThis is a
141df930be7Sderaadt.Em dangerous
142d75d9cd0Smillertflag to set since it does not guarantee to keep a consistent
1439615e1d4Saaronfile system structure on the disk.
1449615e1d4SaaronYou should not use this flag
145d75d9cd0Smillertunless you are prepared to recreate the file system should your
1469615e1d4Saaronsystem crash.
1479615e1d4SaaronThe most common use of this flag is to speed up
148d75d9cd0Smillert.Xr restore 8
149d75d9cd0Smillertwhere it can give a factor of two speed increase.
15087417654Sgluk.It softdep
151ebeb71c1Saaron(FFS only.)
152ebeb71c1SaaronMount the file system using soft dependencies.
153ebeb71c1SaaronInstead of metadata being written immediately, it is written in an ordered
15498a9ff97Saaronfashion to keep the on-disk state of the file system consistent.
15587417654SglukThis results in significant speedups for file create/delete operations.
156ebeb71c1SaaronThis option will be ignored when using the
157ebeb71c1Saaron.Fl u
158ebeb71c1Saaronflag and a file system is already mounted read/write.
159ebeb71c1SaaronIt requires
160ebeb71c1Saaron.Cm option FFS_SOFTUPDATES
161ebeb71c1Saaronto be enabled in the running kernel.
162df930be7Sderaadt.It force
163df930be7SderaadtThe same as
164df930be7Sderaadt.Fl f ;
165df930be7Sderaadtforces the revocation of write access when trying to downgrade
166df930be7Sderaadta file system mount status from read-write to read-only.
16711ce5bb8Smillert.It noatime
168297c680fSmillertDo not update atime on files in the system unless the mtime or ctime
169297c680fSmillertis being changed as well.
170297c680fSmillertThis option is useful for laptops and news servers where one does
171297c680fSmillertnot want the extra disk activity associated with updating the atime.
17211ce5bb8Smillert.It noaccesstime
17311ce5bb8SmillertSynonym for noatime provided for compatibility with
17495675cd5Saaronother operating systems.
175df930be7Sderaadt.It nodev
176df930be7SderaadtDo not interpret character or block special devices on the file system.
177df930be7SderaadtThis option is useful for a server that has file systems containing
178df930be7Sderaadtspecial devices for architectures other than its own.
179df930be7Sderaadt.It noexec
180df930be7SderaadtDo not allow execution of any binaries on the mounted file system.
181df930be7SderaadtThis option is useful for a server that has file systems containing
182df930be7Sderaadtbinaries for architectures other than its own.
183df930be7Sderaadt.It nosuid
184df930be7SderaadtDo not allow set-user-identifier or set-group-identifier bits to take effect.
185df930be7Sderaadt.It rdonly
186df930be7SderaadtThe same as
187df930be7Sderaadt.Fl r ;
188a3542fadSaaronmount the file system read-only (even the superuser may not write it).
189df930be7Sderaadt.It sync
190df930be7SderaadtAll
191df930be7Sderaadt.Tn I/O
192df930be7Sderaadtto the file system should be done synchronously.
193df930be7Sderaadt.It update
194df930be7SderaadtThe same as
195df930be7Sderaadt.Fl u ;
196df930be7Sderaadtindicate that the status of an already mounted file system should be changed.
197df930be7Sderaadt.It union
198df930be7SderaadtCauses the namespace at the mount point to appear as the union
199df930be7Sderaadtof the mounted file system root and the existing directory.
200df930be7SderaadtLookups will be done in the mounted file system first.
201df930be7SderaadtIf those operations fail due to a non-existent file the underlying
202df930be7Sderaadtdirectory is then accessed.
203df930be7SderaadtAll creates are done in the mounted file system.
204df930be7Sderaadt.El
205df930be7Sderaadt.Pp
206df930be7SderaadtAny additional options specific to a given file system type (see the
207df930be7Sderaadt.Fl t
208df930be7Sderaadtoption) may be passed as a comma separated list; these options are
209df930be7Sderaadtdistinguished by a leading
210df930be7Sderaadt.Dq \&-
211df930be7Sderaadt(dash).
212df930be7SderaadtOptions that take a value are specified using the syntax -option=value.
2135eaf1a72SaaronFor example, the
21458aefd4bSaaron.Nm
2155eaf1a72Saaroncommand:
216df930be7Sderaadt.Bd -literal -offset indent
217f314c710Smpech# mount -t mfs -o nosuid,-N,-s=4000 /dev/dk0b /tmp
218df930be7Sderaadt.Ed
219df930be7Sderaadt.Pp
220df930be7Sderaadtcauses
22158aefd4bSaaron.Nm
222df930be7Sderaadtto execute the equivalent of:
223df930be7Sderaadt.Bd -literal -offset indent
224f314c710Smpech# /sbin/mount_mfs -o nosuid -N -s 4000 /dev/dk0b /tmp
225df930be7Sderaadt.Ed
226df930be7Sderaadt.It Fl r
227df930be7SderaadtThe file system is to be mounted read-only.
228a3542fadSaaronMount the file system read-only (even the superuser may not write it).
229df930be7SderaadtThe same as the
230df930be7Sderaadt.Dq rdonly
231df930be7Sderaadtargument to the
232df930be7Sderaadt.Fl o
233df930be7Sderaadtoption.
234df930be7Sderaadt.It Fl t Ar type
235df930be7SderaadtThe argument following the
236df930be7Sderaadt.Fl t
237df930be7Sderaadtis used to indicate the file system type.
238df930be7SderaadtThe type
239df930be7Sderaadt.Ar ffs
240df930be7Sderaadtis the default.
2415eaf1a72SaaronThe
2425eaf1a72Saaron.Fl t
2435eaf1a72Saaronoption can be used
244df930be7Sderaadtto indicate that the actions should only be taken on
245df930be7Sderaadtfile systems of the specified type.
246df930be7SderaadtMore than one type may be specified in a comma separated list.
247df930be7SderaadtThe list of file system types can be prefixed with
248df930be7Sderaadt.Dq no
249df930be7Sderaadtto specify the file system types for which action should
250df930be7Sderaadt.Em not
251df930be7Sderaadtbe taken.
252df930be7SderaadtFor example, the
25358aefd4bSaaron.Nm
254df930be7Sderaadtcommand:
255df930be7Sderaadt.Bd -literal -offset indent
256f314c710Smpech# mount -a -t nonfs,mfs
257df930be7Sderaadt.Ed
258df930be7Sderaadt.Pp
259df930be7Sderaadtmounts all file systems except those of type
260df930be7Sderaadt.Tn NFS
261df930be7Sderaadtand
262df930be7Sderaadt.Tn MFS .
263df930be7Sderaadt.Pp
26458aefd4bSaaron.Nm
265df930be7Sderaadtwill attempt to execute a program in
266df930be7Sderaadt.Pa /sbin/mount_ Ns Em XXX
267df930be7Sderaadtwhere
268df930be7Sderaadt.Em XXX
269df930be7Sderaadtis replaced by the type name.
27037446623SjmcFor example, NFS file systems are mounted by the program
271df930be7Sderaadt.Pa /sbin/mount_nfs .
272df930be7Sderaadt.It Fl u
273df930be7SderaadtThe
274df930be7Sderaadt.Fl u
275df930be7Sderaadtflag indicates that the status of an already mounted file
276df930be7Sderaadtsystem should be changed.
277df930be7SderaadtAny of the options discussed above (the
278df930be7Sderaadt.Fl o
279df930be7Sderaadtoption)
280df930be7Sderaadtmay be changed;
281df930be7Sderaadtalso a file system can be changed from read-only to read-write
282df930be7Sderaadtor vice versa.
283df930be7SderaadtAn attempt to change from read-write to read-only will fail if any
284df930be7Sderaadtfiles on the file system are currently open for writing unless the
285df930be7Sderaadt.Fl f
286df930be7Sderaadtflag is also specified.
287195e5a59SangelosThe file system options are set to those specified in the command line.
288195e5a59SangelosThe options set in the
289ffbe7eb8Sderaadt.Xr fstab 5
290195e5a59Sangelostable are ignored.
291df930be7Sderaadt.It Fl v
292df930be7SderaadtVerbose mode.
293df930be7Sderaadt.It Fl w
294df930be7SderaadtThe file system object is to be read and write.
295df930be7Sderaadt.El
296df930be7Sderaadt.Pp
297df930be7SderaadtThe options specific to the various file system types are
298df930be7Sderaadtdescribed in the manual pages for those file systems'
299df930be7Sderaadt.Nm mount_XXX
3009615e1d4Saaroncommands.
3019615e1d4SaaronFor instance, the options specific to Berkeley
302df930be7SderaadtFast File Systems are described in the
303df930be7Sderaadt.Xr mount_ffs 8
304df930be7Sderaadtmanual page.
305f9fb160fSderaadt.Sh EXAMPLES
306f9fb160fSderaadt.Bd -literal
30786dd7d2cSderaadt.Pp
308cbab7b70Sderaadt.Li # mount -t cd9660 -r /dev/cd0a /mnt/cdrom
30986dd7d2cSderaadt.Pp
310cbab7b70Sderaadt.Li # mount -t msdos /dev/fd0a /mnt/floppy
31186dd7d2cSderaadt.Pp
312cbab7b70Sderaadt.Li # mount host:/path/name /mnt/nfs
31386dd7d2cSderaadt.Pp
314cf8622b1Saaron.Ed
315df930be7Sderaadt.Sh FILES
316df930be7Sderaadt.Bl -tag -width /etc/fstab -compact
317df930be7Sderaadt.It Pa /etc/fstab
318df930be7Sderaadtfile system table
319df930be7Sderaadt.El
320df930be7Sderaadt.Sh SEE ALSO
321df930be7Sderaadt.Xr mount 2 ,
322df930be7Sderaadt.Xr fstab 5 ,
323ba98c64dSespie.Xr disklabel 8 ,
324df930be7Sderaadt.Xr mount_ados 8 ,
325df930be7Sderaadt.Xr mount_cd9660 8 ,
326a79db1ccSespie.Xr mount_ext2fs 8 ,
327df930be7Sderaadt.Xr mount_fdesc 8 ,
328df930be7Sderaadt.Xr mount_ffs 8 ,
329df930be7Sderaadt.Xr mount_kernfs 8 ,
330df930be7Sderaadt.Xr mount_mfs 8 ,
331df930be7Sderaadt.Xr mount_msdos 8 ,
332df930be7Sderaadt.Xr mount_nfs 8 ,
333df930be7Sderaadt.Xr mount_null 8 ,
334df930be7Sderaadt.Xr mount_portal 8 ,
335df930be7Sderaadt.Xr mount_procfs 8 ,
336df930be7Sderaadt.Xr mount_umap 8 ,
337df930be7Sderaadt.Xr mount_union 8 ,
338c607ffb7Sart.Xr mount_xfs 8 ,
339581d34a0Spjanzen.Xr sysctl 8 ,
3407acc01d2Saaron.Xr umount 8
341df930be7Sderaadt.Sh HISTORY
342df930be7SderaadtA
34358aefd4bSaaron.Nm
344df930be7Sderaadtcommand appeared in
34538556bf7Smickey.At v3 .
346