xref: /openbsd/sbin/mount/mount.8 (revision 9b7c3dbb)
1.\"	$OpenBSD: mount.8,v 1.83 2016/08/27 22:30:23 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: August 27 2016 $
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 AadfNruvw
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 is either a
71.Xr disklabel 8
72UID (DUID) or an entry in
73.Pa /dev .
74If it is a DUID,
75it will be automatically mapped to the appropriate entry in
76.Pa /dev .
77In either case the partition must be present
78in the disklabel loaded from the device.
79The partition name is the last letter in the entry name.
80For example, /dev/sd0a and 3eb7f9da875cb9ee.a both refer to the
81.Sq a
82partition.
83.Pp
84A mount point
85.Ar node
86must be an existing directory for a mount to succeed
87.Po
88except in the special case of
89.Pa / ,
90of course
91.Pc .
92Only the superuser may mount file systems.
93.Pp
94The system maintains a list of currently mounted file systems.
95If no arguments are given to
96.Nm mount ,
97this list is printed.
98.Pp
99The options are as follows:
100.Bl -tag -width Ds
101.It Fl A
102Causes
103.Nm
104to try to mount all of the file systems listed in the
105.Xr fstab 5
106table except those for which the
107.Dq noauto
108or
109.Dq net
110options are 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 N
138If used with either
139.Fl A
140or
141.Fl a ,
142.Nm
143will only look at file systems which have the
144.Dq net
145option specified.
146By default file systems with the
147.Dq net
148option are ignored.
149.It Fl o Ar options
150Options can be given with (or without) a
151.Sq no
152prefix to invert their meaning.
153The options listed below specify non-default values.
154For example,
155.Sq nosoftdep
156is the default, so
157.Sq softdep
158can be used to mount the file system using soft dependencies.
159Multiple options can be specified in a comma-separated list.
160The available options are as follows:
161.Bl -tag -width 9n
162.It async
163Metadata I/O to the file system should be done asynchronously.
164By default, only regular data is read/written asynchronously.
165.Pp
166This is a
167.Em dangerous
168flag to set since it does not guarantee to keep a consistent
169file system structure on the disk.
170You should not use this flag
171unless you are prepared to recreate the file system should your
172system crash.
173The most common use of this flag is to speed up
174.Xr restore 8
175where it can give a factor of two speed increase.
176.Pp
177The options
178.Ic async
179and
180.Ic softdep
181are mutually exclusive.
182.It force
183The same as
184.Fl f ;
185forces the revocation of write access when trying to downgrade
186a file system mount status from read-write to read-only.
187.It noatime
188Do not update atime on files in the system unless the mtime or ctime
189is being changed as well.
190This option is useful for laptops and news servers where one does
191not want the extra disk activity associated with updating the atime.
192.It nodev
193Do not interpret character or block special devices on the file system.
194This option is useful for a server that has file systems containing
195special devices for architectures other than its own.
196.It noexec
197Do not allow execution of any binaries on the mounted file system.
198This option is useful for a server that has file systems containing
199binaries for architectures other than its own.
200.It norw
201An alias for rdonly.
202.It nosuid
203Do not allow set-user-identifier or set-group-identifier bits to take effect.
204.It rdonly
205The same as
206.Fl r ;
207mount the file system read-only (even the superuser may not write it).
208.It ro
209An alias for rdonly.
210.It softdep
211(FFS only.)
212Mount the file system using soft dependencies.
213Instead of metadata being written immediately, it is written in an ordered
214fashion to keep the on-disk state of the file system consistent.
215This results in significant speedups for file create/delete operations.
216This option is ignored when using the
217.Fl u
218flag and a file system is already mounted read/write.
219.Pp
220The options
221.Ic async
222and
223.Ic softdep
224are mutually exclusive.
225.It sync
226Regular data I/O to the file system should be done synchronously.
227By default, only metadata is read/written synchronously.
228.It update
229The same as
230.Fl u ;
231indicate that the status of an already mounted file system should be changed.
232.It wxallowed
233Processes that ask for memory to be made writeable plus executable
234using the
235.Xr mmap 2
236and
237.Xr mprotect 2
238system calls are killed by default.
239This option allows those processes to continue operation.
240It is typically used on the
241.Pa /usr/local
242filesystem.
243.El
244.Pp
245Any additional options specific to a given file system type (see the
246.Fl t
247option) may be passed as a comma separated list; these options are
248distinguished by a leading
249.Dq \&-
250(dash).
251Options that take a value are specified using the syntax -option=value.
252For example:
253.Bd -literal -offset 3n
254# mount -t mfs -o rw,nodev,nosuid,-s=153600 /dev/sd0b /tmp
255.Ed
256.Pp
257That causes
258.Nm
259to execute the equivalent of:
260.Bd -literal -offset 3n
261# /sbin/mount_mfs -o rw,nodev,nosuid -s 153600 /dev/sd0b /tmp
262.Ed
263.Pp
264The equivalent example in
265.Xr fstab 5
266would be:
267.Bd -literal -offset 3n
268swap /tmp mfs rw,nodev,nosuid,-s=153600 0 0
269.Ed
270.It Fl r
271The file system is to be mounted read-only.
272Mount the file system read-only (even the superuser may not write it).
273The same as the
274.Dq rdonly
275argument to the
276.Fl o
277option.
278.It Fl s
279Skip mounting the file system if it is already mounted.
280See the
281.Fl a
282flag for a description of the criteria used to decide if a file system
283is already mounted.
284.It Fl t Ar type
285The argument following the
286.Fl t
287is used to indicate the file system type.
288The type
289.Ar ffs
290is the default.
291The
292.Fl t
293option can be used
294to indicate that the actions should only be taken on
295file systems of the specified type.
296More than one type may be specified in a comma separated list.
297The list of file system types can be prefixed with
298.Dq no
299to specify the file system types for which action should
300.Em not
301be taken.
302For example, the
303.Nm
304command:
305.Bd -literal -offset indent
306# mount -a -t nonfs,mfs
307.Ed
308.Pp
309mounts all file systems except those of type NFS and MFS .
310.Pp
311.Nm
312will attempt to execute a program in
313.Pa /sbin/mount_ Ns Em XXX
314where
315.Em XXX
316is replaced by the type name.
317For example, NFS file systems are mounted by the program
318.Pa /sbin/mount_nfs .
319.It Fl u
320The
321.Fl u
322flag indicates that the status of an already mounted file
323system should be changed.
324Any of the options discussed above (the
325.Fl o
326option)
327may be changed;
328also a file system can be changed from read-only to read-write
329or vice versa.
330An attempt to change from read-write to read-only will fail if any
331files on the file system are currently open for writing unless the
332.Fl f
333flag is also specified.
334Only options specified on the command line with
335.Fl o
336are changed;
337other file system options are unaltered.
338The options set in the
339.Xr fstab 5
340table are ignored.
341.It Fl v
342Verbose mode.
343.It Fl w
344The file system object is to be read and write.
345.El
346.Pp
347The options specific to the various file system types are
348described in the manual pages for those file systems'
349.Nm mount_XXX
350commands.
351For instance, the options specific to Berkeley
352Fast File Systems are described in the
353.Xr mount_ffs 8
354manual page.
355.Sh FILES
356.Bl -tag -width /etc/fstab -compact
357.It Pa /etc/fstab
358file system table
359.El
360.Sh EXAMPLES
361Mount a CD-ROM on node
362.Pa /mnt/cdrom :
363.Pp
364.Dl # mount -t cd9660 -r /dev/cd0a /mnt/cdrom
365.Pp
366Mount an MS-DOS USB stick with DUID 3eb7f9da875cb9ee on node
367.Pa /mnt/key :
368.Pp
369.Dl # mount -t msdos 3eb7f9da875cb9ee.i /mnt/key
370.Pp
371Graft a remote NFS file system on host
372.Ar host ,
373path
374.Pa /path/name ,
375on node
376.Pa /mnt/nfs :
377.Pp
378.Dl # mount host:/path/name /mnt/nfs
379.Pp
380Remount
381.Pa /var
382with option
383.Dq dev :
384.Pp
385.Dl # mount -u -o dev /var
386.Sh SEE ALSO
387.Xr mount 2 ,
388.Xr fstab 5 ,
389.Xr disklabel 8 ,
390.Xr mount_cd9660 8 ,
391.Xr mount_ext2fs 8 ,
392.Xr mount_ffs 8 ,
393.Xr mount_mfs 8 ,
394.Xr mount_msdos 8 ,
395.Xr mount_nfs 8 ,
396.Xr mount_ntfs 8 ,
397.Xr mount_tmpfs 8 ,
398.Xr mount_udf 8 ,
399.Xr mount_vnd 8 ,
400.Xr sysctl 8 ,
401.Xr umount 8
402.Sh HISTORY
403A
404.Nm
405command appeared in
406.At v3 .
407.Sh CAVEATS
408After a successful
409.Nm mount ,
410the permissions on the original mount point determine if
411.Dq \&.\&.
412is accessible from the mounted file system.
413The minimum permissions for
414the mount point for traversal across the mount point in both
415directions to be possible for all users is 0111 (execute for all).
416