xref: /openbsd/sbin/mount/mount.8 (revision f362e36b)
1*f362e36bSotto.\"	$OpenBSD: mount.8,v 1.55 2006/03/12 20:01:31 otto 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.
151ef0d710Smillert.\" 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
44*f362e36bSotto.Op Fl dfrsuvw
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
9244718940Sjmc.Pc ,
9344718940Sjmcthe
9444718940Sjmc.Ar special
9544718940Sjmcdevice
9644718940Sjmcis readable and writeable by the user attempting the mount,
9744718940Sjmcand the mount point
9844718940Sjmc.Ar node
9944718940Sjmcis owned by the user attempting the mount.
100581d34a0Spjanzen.Pp
101f1ba3473SaaronThe options are as follows:
102f1ba3473Saaron.Bl -tag -width Ds
103df930be7Sderaadt.It Fl A
104df930be7SderaadtCauses
10558aefd4bSaaron.Nm
106df930be7Sderaadtto try to mount all of the file systems listed in the
107ffbe7eb8Sderaadt.Xr fstab 5
108df930be7Sderaadttable except those for which the
109df930be7Sderaadt.Dq noauto
110df930be7Sderaadtoption is specified.
111df930be7Sderaadt.It Fl a
112df930be7SderaadtSimilar to the
113df930be7Sderaadt.Fl A
114df930be7Sderaadtflag, except that if a file system (other than the root file system)
115df930be7Sderaadtappears to be already mounted,
11658aefd4bSaaron.Nm
117df930be7Sderaadtwill not try to mount it again.
11858aefd4bSaaron.Nm
119df930be7Sderaadtassumes that a file system is already mounted if a file system with
120df930be7Sderaadtthe same type is mounted on the given mount point.
121df930be7SderaadtMore stringent checks are not possible because some file system types
122df930be7Sderaadtreport strange values for the mounted-from device for mounted file
123df930be7Sderaadtsystems.
124df930be7Sderaadt.It Fl d
125df930be7SderaadtCauses everything to be done except for the invocation of
12605d692a5Steduthe file system specific program.
127df930be7SderaadtThis option is useful in conjunction with the
128df930be7Sderaadt.Fl v
129df930be7Sderaadtflag to
130df930be7Sderaadtdetermine what the
13158aefd4bSaaron.Nm
132df930be7Sderaadtcommand is trying to do.
133df930be7Sderaadt.It Fl f
134e63188c1SpvalchevEither force mounting of dirty file systems or, in the case of a
135bd182408Sniklasdowngrade from read-write to read-only operation, the revocation of
136bd182408Sniklasopened files with write access.
137b24688ffSderaadt.It Fl o Ar options
138de3b3330SottoOptions can be given with (or without) a
139de3b3330Sotto.Sq no
140de3b3330Sottoprefix to invert their meaning.
141de3b3330SottoThe options listed below specify non-default values.
142de3b3330SottoFor example,
143de3b3330Sotto.Sq noasync
144de3b3330Sottois the default, so
145de3b3330Sotto.Sq async
146de3b3330Sottocan be used to mount a file system asynchronously.
147de3b3330SottoMultiple options can be specified in a comma-separated list.
148de3b3330SottoThe available options are as follows:
149f1ba3473Saaron.Bl -tag -width Ds
150df930be7Sderaadt.It async
151df930be7SderaadtAll
152df930be7Sderaadt.Tn I/O
153df930be7Sderaadtto the file system should be done asynchronously.
154df930be7SderaadtThis is a
155df930be7Sderaadt.Em dangerous
156d75d9cd0Smillertflag to set since it does not guarantee to keep a consistent
1579615e1d4Saaronfile system structure on the disk.
1589615e1d4SaaronYou should not use this flag
159d75d9cd0Smillertunless you are prepared to recreate the file system should your
1609615e1d4Saaronsystem crash.
1619615e1d4SaaronThe most common use of this flag is to speed up
162d75d9cd0Smillert.Xr restore 8
163d75d9cd0Smillertwhere it can give a factor of two speed increase.
16487417654Sgluk.It softdep
165ebeb71c1Saaron(FFS only.)
166ebeb71c1SaaronMount the file system using soft dependencies.
167ebeb71c1SaaronInstead of metadata being written immediately, it is written in an ordered
16898a9ff97Saaronfashion to keep the on-disk state of the file system consistent.
16987417654SglukThis results in significant speedups for file create/delete operations.
170ebeb71c1SaaronThis option will be ignored when using the
171ebeb71c1Saaron.Fl u
172ebeb71c1Saaronflag and a file system is already mounted read/write.
173ebeb71c1SaaronIt requires
174ebeb71c1Saaron.Cm option FFS_SOFTUPDATES
175ebeb71c1Saaronto be enabled in the running kernel.
176df930be7Sderaadt.It force
177df930be7SderaadtThe same as
178df930be7Sderaadt.Fl f ;
179df930be7Sderaadtforces the revocation of write access when trying to downgrade
180df930be7Sderaadta file system mount status from read-write to read-only.
18111ce5bb8Smillert.It noatime
182297c680fSmillertDo not update atime on files in the system unless the mtime or ctime
183297c680fSmillertis being changed as well.
184297c680fSmillertThis option is useful for laptops and news servers where one does
185297c680fSmillertnot want the extra disk activity associated with updating the atime.
18611ce5bb8Smillert.It noaccesstime
18711ce5bb8SmillertSynonym for noatime provided for compatibility with
18895675cd5Saaronother operating systems.
189f80aa8f6Sjmc.It noauto
190f80aa8f6SjmcDo not mount the file system automatically
191f80aa8f6Sjmc(either at boot or with the
192f80aa8f6Sjmc.Fl A
193f80aa8f6Sjmcor
194f80aa8f6Sjmc.Fl a
195f80aa8f6Sjmcoptions).
196df930be7Sderaadt.It nodev
197df930be7SderaadtDo not interpret character or block special devices on the file system.
198df930be7SderaadtThis option is useful for a server that has file systems containing
199df930be7Sderaadtspecial devices for architectures other than its own.
200df930be7Sderaadt.It noexec
201df930be7SderaadtDo not allow execution of any binaries on the mounted file system.
202df930be7SderaadtThis option is useful for a server that has file systems containing
203df930be7Sderaadtbinaries for architectures other than its own.
204df930be7Sderaadt.It nosuid
205df930be7SderaadtDo not allow set-user-identifier or set-group-identifier bits to take effect.
206df930be7Sderaadt.It rdonly
207df930be7SderaadtThe same as
208df930be7Sderaadt.Fl r ;
209a3542fadSaaronmount the file system read-only (even the superuser may not write it).
210df930be7Sderaadt.It sync
211df930be7SderaadtAll
212df930be7Sderaadt.Tn I/O
213df930be7Sderaadtto the file system should be done synchronously.
214df930be7Sderaadt.It update
215df930be7SderaadtThe same as
216df930be7Sderaadt.Fl u ;
217df930be7Sderaadtindicate that the status of an already mounted file system should be changed.
218df930be7Sderaadt.El
219df930be7Sderaadt.Pp
220df930be7SderaadtAny additional options specific to a given file system type (see the
221df930be7Sderaadt.Fl t
222df930be7Sderaadtoption) may be passed as a comma separated list; these options are
223df930be7Sderaadtdistinguished by a leading
224df930be7Sderaadt.Dq \&-
225df930be7Sderaadt(dash).
226df930be7SderaadtOptions that take a value are specified using the syntax -option=value.
2275eaf1a72SaaronFor example, the
22858aefd4bSaaron.Nm
2295eaf1a72Saaroncommand:
230df930be7Sderaadt.Bd -literal -offset indent
2310add6844Sdavid# mount -t mfs -o nosuid,-s=4000 /dev/sd0b /tmp
232df930be7Sderaadt.Ed
233df930be7Sderaadt.Pp
234df930be7Sderaadtcauses
23558aefd4bSaaron.Nm
236df930be7Sderaadtto execute the equivalent of:
237df930be7Sderaadt.Bd -literal -offset indent
2380add6844Sdavid# /sbin/mount_mfs -o nosuid -s 4000 /dev/sd0b /tmp
239df930be7Sderaadt.Ed
240df930be7Sderaadt.It Fl r
241df930be7SderaadtThe file system is to be mounted read-only.
242a3542fadSaaronMount the file system read-only (even the superuser may not write it).
243df930be7SderaadtThe same as the
244df930be7Sderaadt.Dq rdonly
245df930be7Sderaadtargument to the
246df930be7Sderaadt.Fl o
247df930be7Sderaadtoption.
248*f362e36bSotto.It Fl s
249*f362e36bSottoSkip mounting the file system if it is already mounted.
250*f362e36bSottoSee the
251*f362e36bSotto.Fl a
252*f362e36bSottoflag for a description of the citeria used to decide if a file system
253*f362e36bSottois already mounted.
254df930be7Sderaadt.It Fl t Ar type
255df930be7SderaadtThe argument following the
256df930be7Sderaadt.Fl t
257df930be7Sderaadtis used to indicate the file system type.
258df930be7SderaadtThe type
259df930be7Sderaadt.Ar ffs
260df930be7Sderaadtis the default.
2615eaf1a72SaaronThe
2625eaf1a72Saaron.Fl t
2635eaf1a72Saaronoption can be used
264df930be7Sderaadtto indicate that the actions should only be taken on
265df930be7Sderaadtfile systems of the specified type.
266df930be7SderaadtMore than one type may be specified in a comma separated list.
267df930be7SderaadtThe list of file system types can be prefixed with
268df930be7Sderaadt.Dq no
269df930be7Sderaadtto specify the file system types for which action should
270df930be7Sderaadt.Em not
271df930be7Sderaadtbe taken.
272df930be7SderaadtFor example, the
27358aefd4bSaaron.Nm
274df930be7Sderaadtcommand:
275df930be7Sderaadt.Bd -literal -offset indent
276f314c710Smpech# mount -a -t nonfs,mfs
277df930be7Sderaadt.Ed
278df930be7Sderaadt.Pp
279df930be7Sderaadtmounts all file systems except those of type
280df930be7Sderaadt.Tn NFS
281df930be7Sderaadtand
282df930be7Sderaadt.Tn MFS .
283df930be7Sderaadt.Pp
28458aefd4bSaaron.Nm
285df930be7Sderaadtwill attempt to execute a program in
286df930be7Sderaadt.Pa /sbin/mount_ Ns Em XXX
287df930be7Sderaadtwhere
288df930be7Sderaadt.Em XXX
289df930be7Sderaadtis replaced by the type name.
29037446623SjmcFor example, NFS file systems are mounted by the program
291df930be7Sderaadt.Pa /sbin/mount_nfs .
292df930be7Sderaadt.It Fl u
293df930be7SderaadtThe
294df930be7Sderaadt.Fl u
295df930be7Sderaadtflag indicates that the status of an already mounted file
296df930be7Sderaadtsystem should be changed.
297df930be7SderaadtAny of the options discussed above (the
298df930be7Sderaadt.Fl o
299df930be7Sderaadtoption)
300df930be7Sderaadtmay be changed;
301df930be7Sderaadtalso a file system can be changed from read-only to read-write
302df930be7Sderaadtor vice versa.
303df930be7SderaadtAn attempt to change from read-write to read-only will fail if any
304df930be7Sderaadtfiles on the file system are currently open for writing unless the
305df930be7Sderaadt.Fl f
306df930be7Sderaadtflag is also specified.
307c6289b3dSjmcOnly options specified on the command line with
308c6289b3dSjmc.Fl o
309c6289b3dSjmcare changed;
310c6289b3dSjmcother file system options are unaltered.
311195e5a59SangelosThe options set in the
312ffbe7eb8Sderaadt.Xr fstab 5
313195e5a59Sangelostable are ignored.
314df930be7Sderaadt.It Fl v
315df930be7SderaadtVerbose mode.
316df930be7Sderaadt.It Fl w
317df930be7SderaadtThe file system object is to be read and write.
318df930be7Sderaadt.El
319df930be7Sderaadt.Pp
320df930be7SderaadtThe options specific to the various file system types are
321df930be7Sderaadtdescribed in the manual pages for those file systems'
322df930be7Sderaadt.Nm mount_XXX
3239615e1d4Saaroncommands.
3249615e1d4SaaronFor instance, the options specific to Berkeley
325df930be7SderaadtFast File Systems are described in the
326df930be7Sderaadt.Xr mount_ffs 8
327df930be7Sderaadtmanual page.
3282b65e200Sjmc.Sh FILES
3292b65e200Sjmc.Bl -tag -width /etc/fstab -compact
3302b65e200Sjmc.It Pa /etc/fstab
3312b65e200Sjmcfile system table
3322b65e200Sjmc.El
333f9fb160fSderaadt.Sh EXAMPLES
33475764ac1SjmcMount a CD-ROM on node
33575764ac1Sjmc.Pa /mnt/cdrom :
33675764ac1Sjmc.Pp
33775764ac1Sjmc.Dl # mount -t cd9660 -r /dev/cd0a /mnt/cdrom
33875764ac1Sjmc.Pp
33975764ac1SjmcMount an MS-DOS floppy on node
34075764ac1Sjmc.Pa /mnt/floppy :
34175764ac1Sjmc.Pp
34275764ac1Sjmc.Dl # mount -t msdos /dev/fd0a /mnt/floppy
34375764ac1Sjmc.Pp
34475764ac1SjmcGraft a remote NFS file system on host
34575764ac1Sjmc.Ar host ,
34675764ac1Sjmcpath
34775764ac1Sjmc.Pa /path/name ,
34875764ac1Sjmcon node
34975764ac1Sjmc.Pa /mnt/nfs :
35075764ac1Sjmc.Pp
35175764ac1Sjmc.Dl # mount host:/path/name /mnt/nfs
35275764ac1Sjmc.Pp
35375764ac1SjmcRemount
35475764ac1Sjmc.Pa /var
35575764ac1Sjmcwith option
35675764ac1Sjmc.Dq dev :
35775764ac1Sjmc.Pp
35875764ac1Sjmc.Dl # mount -u -o dev /var
359df930be7Sderaadt.Sh SEE ALSO
360df930be7Sderaadt.Xr mount 2 ,
361df930be7Sderaadt.Xr fstab 5 ,
362ba98c64dSespie.Xr disklabel 8 ,
363df930be7Sderaadt.Xr mount_ados 8 ,
364df930be7Sderaadt.Xr mount_cd9660 8 ,
365a79db1ccSespie.Xr mount_ext2fs 8 ,
366df930be7Sderaadt.Xr mount_ffs 8 ,
367df930be7Sderaadt.Xr mount_mfs 8 ,
368df930be7Sderaadt.Xr mount_msdos 8 ,
369df930be7Sderaadt.Xr mount_nfs 8 ,
370a0e70a0fSjmc.Xr mount_ntfs 8 ,
371df930be7Sderaadt.Xr mount_portal 8 ,
372df930be7Sderaadt.Xr mount_procfs 8 ,
373e8851720Sjmc.Xr mount_udf 8 ,
374c607ffb7Sart.Xr mount_xfs 8 ,
375581d34a0Spjanzen.Xr sysctl 8 ,
3767acc01d2Saaron.Xr umount 8
377df930be7Sderaadt.Sh HISTORY
378df930be7SderaadtA
37958aefd4bSaaron.Nm
380df930be7Sderaadtcommand appeared in
38138556bf7Smickey.At v3 .
382028d5877Sjmc.Sh CAVEATS
383028d5877SjmcAfter a successful
384028d5877Sjmc.Nm mount ,
385028d5877Sjmcthe permissions on the original mount point determine if
386028d5877Sjmc.Dq \&.\&.
387028d5877Sjmcis accessible from the mounted file system.
388028d5877SjmcThe minimum permissions for
389028d5877Sjmcthe mount point for traversal across the mount point in both
390028d5877Sjmcdirections to be possible for all users is 0111 (execute for all).
391