xref: /openbsd/sbin/mount/mount.8 (revision 404b540a)
1.\"	$OpenBSD: mount.8,v 1.66 2009/06/04 13:30:06 jmc 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. Neither the name of the University nor the names of its contributors
16.\"    may be used to endorse or promote products derived from this software
17.\"    without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29.\" SUCH DAMAGE.
30.\"
31.\"     @(#)mount.8	8.7 (Berkeley) 3/27/94
32.\"
33.Dd $Mdocdate: June 4 2009 $
34.Dt MOUNT 8
35.Os
36.Sh NAME
37.Nm mount
38.Nd mount file systems
39.Sh SYNOPSIS
40.Nm mount
41.Op Fl Aadfruvw
42.Op Fl t Ar type
43.Nm mount
44.Op Fl dfrsuvw
45.Ar special | node
46.Nm mount
47.Op Fl dfruvw
48.Op Fl o Ar options
49.Op Fl t Ar type
50.Ar special node
51.Sh DESCRIPTION
52The
53.Nm
54command invokes a file system specific program to prepare
55and graft the
56.Ar special
57device or remote node (rhost:path) on to the file system
58tree at the point
59.Ar node .
60If either
61.Ar special
62or
63.Ar node
64are not provided, the appropriate information is taken from the
65.Xr fstab 5
66file.
67.Pp
68For disk partitions, the
69.Ar special
70device must correspond to a partition registered in the
71.Xr disklabel 5 .
72.Pp
73The system maintains a list of currently mounted file systems.
74If no arguments are given to
75.Nm mount ,
76this list is printed.
77.Pp
78A mount point
79.Ar node
80must be an existing directory for a mount to succeed
81.Po
82except in the special case of
83.Pa / ,
84of course
85.Pc .
86Only the superuser may mount file systems unless
87.Va kern.usermount
88is nonzero
89.Po
90see
91.Xr sysctl 8
92.Pc ,
93the
94.Ar special
95device
96is readable and writeable by the user attempting the mount,
97and the mount point
98.Ar node
99is owned by the user attempting the mount.
100.Pp
101The options are as follows:
102.Bl -tag -width Ds
103.It Fl A
104Causes
105.Nm
106to try to mount all of the file systems listed in the
107.Xr fstab 5
108table except those for which the
109.Dq noauto
110option is specified.
111.It Fl a
112Similar to the
113.Fl A
114flag, except that if a file system (other than the root file system)
115appears to be already mounted,
116.Nm
117will not try to mount it again.
118.Nm
119assumes that a file system is already mounted if a file system with
120the same type is mounted on the given mount point.
121More stringent checks are not possible because some file system types
122report strange values for the mounted-from device for mounted file
123systems.
124.It Fl d
125Causes everything to be done except for the invocation of
126the file system specific program.
127This option is useful in conjunction with the
128.Fl v
129flag to
130determine what the
131.Nm
132command is trying to do.
133.It Fl f
134Either force mounting of dirty file systems or, in the case of a
135downgrade from read-write to read-only operation, the revocation of
136opened files with write access.
137.It Fl o Ar options
138Options can be given with (or without) a
139.Sq no
140prefix to invert their meaning.
141The options listed below specify non-default values.
142For example,
143.Sq nosoftdep
144is the default, so
145.Sq softdep
146can be used to mount the file system using soft dependencies.
147Multiple options can be specified in a comma-separated list.
148The available options are as follows:
149.Bl -tag -width Ds
150.It async
151Metadata I/O to the file system should be done asynchronously.
152By default, only regular data is read/written asynchronously.
153.Pp
154This is a
155.Em dangerous
156flag to set since it does not guarantee to keep a consistent
157file system structure on the disk.
158You should not use this flag
159unless you are prepared to recreate the file system should your
160system crash.
161The most common use of this flag is to speed up
162.Xr restore 8
163where it can give a factor of two speed increase.
164.Pp
165The options
166.Ic async
167and
168.Ic softdep
169are mutually exclusive.
170.It force
171The same as
172.Fl f ;
173forces the revocation of write access when trying to downgrade
174a file system mount status from read-write to read-only.
175.It noatime
176Do not update atime on files in the system unless the mtime or ctime
177is being changed as well.
178This option is useful for laptops and news servers where one does
179not want the extra disk activity associated with updating the atime.
180.It noauto
181Do not mount the file system automatically
182(either at boot or with the
183.Fl A
184or
185.Fl a
186options).
187.It noaccesstime
188Synonym for noatime provided for compatibility with
189other operating systems.
190.It nodev
191Do not interpret character or block special devices on the file system.
192This option is useful for a server that has file systems containing
193special devices for architectures other than its own.
194.It noexec
195Do not allow execution of any binaries on the mounted file system.
196This option is useful for a server that has file systems containing
197binaries for architectures other than its own.
198.It nosuid
199Do not allow set-user-identifier or set-group-identifier bits to take effect.
200.It rdonly
201The same as
202.Fl r ;
203mount the file system read-only (even the superuser may not write it).
204.It softdep
205(FFS only.)
206Mount the file system using soft dependencies.
207Instead of metadata being written immediately, it is written in an ordered
208fashion to keep the on-disk state of the file system consistent.
209This results in significant speedups for file create/delete operations.
210This option is ignored when using the
211.Fl u
212flag and a file system is already mounted read/write.
213.Pp
214The options
215.Ic async
216and
217.Ic softdep
218are mutually exclusive.
219.It sync
220Regular data I/O to the file system should be done synchronously.
221By default, only metadata is read/written synchronously.
222.Pp
223.It update
224The same as
225.Fl u ;
226indicate that the status of an already mounted file system should be changed.
227.El
228.Pp
229Any additional options specific to a given file system type (see the
230.Fl t
231option) may be passed as a comma separated list; these options are
232distinguished by a leading
233.Dq \&-
234(dash).
235Options that take a value are specified using the syntax -option=value.
236For example:
237.Bd -literal -offset 3n
238# mount -t mfs -o rw,nodev,nosuid,-s=153600 /dev/sd0b /tmp
239.Ed
240.Pp
241That causes
242.Nm
243to execute the equivalent of:
244.Bd -literal -offset 3n
245# /sbin/mount_mfs -o rw,nodev,nosuid -s 153600 /dev/sd0b /tmp
246.Ed
247.Pp
248The equivalent example in
249.Xr fstab 5
250would be:
251.Bd -literal -offset 3n
252swap /tmp mfs rw,nodev,nosuid,-s=153600 0 0
253.Ed
254.It Fl r
255The file system is to be mounted read-only.
256Mount the file system read-only (even the superuser may not write it).
257The same as the
258.Dq rdonly
259argument to the
260.Fl o
261option.
262.It Fl s
263Skip mounting the file system if it is already mounted.
264See the
265.Fl a
266flag for a description of the criteria used to decide if a file system
267is already mounted.
268.It Fl t Ar type
269The argument following the
270.Fl t
271is used to indicate the file system type.
272The type
273.Ar ffs
274is the default.
275The
276.Fl t
277option can be used
278to indicate that the actions should only be taken on
279file systems of the specified type.
280More than one type may be specified in a comma separated list.
281The list of file system types can be prefixed with
282.Dq no
283to specify the file system types for which action should
284.Em not
285be taken.
286For example, the
287.Nm
288command:
289.Bd -literal -offset indent
290# mount -a -t nonfs,mfs
291.Ed
292.Pp
293mounts all file systems except those of type NFS and MFS .
294.Pp
295.Nm
296will attempt to execute a program in
297.Pa /sbin/mount_ Ns Em XXX
298where
299.Em XXX
300is replaced by the type name.
301For example, NFS file systems are mounted by the program
302.Pa /sbin/mount_nfs .
303.It Fl u
304The
305.Fl u
306flag indicates that the status of an already mounted file
307system should be changed.
308Any of the options discussed above (the
309.Fl o
310option)
311may be changed;
312also a file system can be changed from read-only to read-write
313or vice versa.
314An attempt to change from read-write to read-only will fail if any
315files on the file system are currently open for writing unless the
316.Fl f
317flag is also specified.
318Only options specified on the command line with
319.Fl o
320are changed;
321other file system options are unaltered.
322The options set in the
323.Xr fstab 5
324table are ignored.
325.It Fl v
326Verbose mode.
327.It Fl w
328The file system object is to be read and write.
329.El
330.Pp
331The options specific to the various file system types are
332described in the manual pages for those file systems'
333.Nm mount_XXX
334commands.
335For instance, the options specific to Berkeley
336Fast File Systems are described in the
337.Xr mount_ffs 8
338manual page.
339.Sh FILES
340.Bl -tag -width /etc/fstab -compact
341.It Pa /etc/fstab
342file system table
343.El
344.Sh EXAMPLES
345Mount a CD-ROM on node
346.Pa /mnt/cdrom :
347.Pp
348.Dl # mount -t cd9660 -r /dev/cd0a /mnt/cdrom
349.Pp
350Mount an MS-DOS floppy on node
351.Pa /mnt/floppy :
352.Pp
353.Dl # mount -t msdos /dev/fd0a /mnt/floppy
354.Pp
355Graft a remote NFS file system on host
356.Ar host ,
357path
358.Pa /path/name ,
359on node
360.Pa /mnt/nfs :
361.Pp
362.Dl # mount host:/path/name /mnt/nfs
363.Pp
364Remount
365.Pa /var
366with option
367.Dq dev :
368.Pp
369.Dl # mount -u -o dev /var
370.Sh SEE ALSO
371.Xr mount 2 ,
372.Xr fstab 5 ,
373.Xr disklabel 8 ,
374.Xr mount_cd9660 8 ,
375.Xr mount_ext2fs 8 ,
376.Xr mount_ffs 8 ,
377.Xr mount_mfs 8 ,
378.Xr mount_msdos 8 ,
379.Xr mount_nfs 8 ,
380.Xr mount_nnpfs 8 ,
381.Xr mount_ntfs 8 ,
382.Xr mount_portal 8 ,
383.Xr mount_procfs 8 ,
384.Xr mount_udf 8 ,
385.Xr mount_vnd 8 ,
386.Xr sysctl 8 ,
387.Xr umount 8
388.Sh HISTORY
389A
390.Nm
391command appeared in
392.At v3 .
393.Sh CAVEATS
394After a successful
395.Nm mount ,
396the permissions on the original mount point determine if
397.Dq \&.\&.
398is accessible from the mounted file system.
399The minimum permissions for
400the mount point for traversal across the mount point in both
401directions to be possible for all users is 0111 (execute for all).
402