xref: /netbsd/sbin/mount/mount.8 (revision bf9ec67e)
1.\"	$NetBSD: mount.8,v 1.34 2002/05/21 11:17:57 lukem Exp $
2.\"
3.\" Copyright (c) 1980, 1989, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"     @(#)mount.8	8.8 (Berkeley) 6/16/94
35.\"
36.Dd May 21, 2002
37.Dt MOUNT 8
38.Os
39.Sh NAME
40.Nm mount
41.Nd mount file systems
42.Sh SYNOPSIS
43.Nm
44.Op Fl Aadfruvw
45.Op Fl t Ar type
46.Nm ""
47.Op Fl dfruvw
48.Ar special | node
49.Nm ""
50.Op Fl dfruvw
51.Op Fl o Ar options
52.Op Fl t Ar type
53.Ar special node
54.Sh DESCRIPTION
55The
56.Nm
57command invokes a filesystem-specific program to prepare and graft the
58.Ar special
59device or remote node (rhost:path) on to the file system tree at the point
60.Ar node .
61If either
62.Ar special
63or
64.Ar node
65are not provided, the appropriate information is taken from the
66.Xr fstab 5
67file. The provided argument is looked up first in the
68.Dq fs_file ,
69then in the
70.Dq fs_spec
71column.
72If both
73.Ar special
74and
75.Ar node
76are given, the disklabel is checked for the filesystem type.
77.Pp
78In
79.Nx ,
80a file system can only be mounted by an ordinary user who owns the
81point
82.Ar node
83and has access to the
84.Ar special
85device (at least read permissions).  In addition, the
86.Em vfs.generic.usermount
87.Xr sysctl 3
88must be set to 1 to permit file system mounting by ordinary users.
89See also
90.Xr sysctl 8 .
91.Pp
92The system maintains a list of currently mounted file systems.
93If no arguments are given to
94.Nm "" ,
95this list is printed.
96.Pp
97The options are as follows:
98.Bl -tag -width indent
99.It Fl A
100Causes
101.Nm
102to try to mount all of the file systems listed in the
103.Xr fstab 5
104file except those for which the
105.Dq noauto
106option is specified.
107.It Fl a
108Similar to the
109.Fl A
110flag, except that if a file system (other than the root file system)
111appears to be already mounted,
112.Nm
113will not try to mount it again.
114.Nm
115assumes that a file system is already mounted if a file system with
116the same type is mounted on the given mount point.
117More stringent checks are not possible because some file system types
118report strange values for the mounted-from device for mounted file
119systems.
120.It Fl d
121Causes everything to be done except for the invocation of
122the filesystem-specific program.
123This option is useful in conjunction with the
124.Fl v
125flag to
126determine what the
127.Nm
128command is trying to do.
129.It Fl f
130Forces the revocation of write access when trying to downgrade
131a filesystem mount status from read-write to read-only.
132.It Fl o
133Options are specified with a
134.Fl o
135flag followed by a comma separated string of options.
136The following options are available:
137.Bl -tag -width nocoredump
138.It Cm async
139All
140.Tn I/O
141to the file system should be done asynchronously.
142In the event of a crash,
143.Em "it is impossible for the system to verify the integrity of data on a file system mounted with this option" .
144You should only use this
145option if you have an application-specific data
146recovery mechanism, or are willing to recreate the file system from
147scratch.
148.It Cm noasync
149Clear
150.Cm async
151mode.
152.It Cm force
153The same as
154.Fl f ;
155forces the revocation of write access when trying to downgrade
156a filesystem mount status from read-write to read-only.
157.It Cm noatime
158Never update the access time field for files.
159This option is useful for optimizing read performance on filesystems
160that are used as news spools.
161.It Cm noauto
162This filesystem should be skipped when mount is run with the
163.Fl a
164flag.
165.It Cm nodev
166Do not interpret character or block special devices on the file system.
167This option is useful for a server that has file systems containing
168special devices for architectures other than its own.
169.It Cm nodevmtime
170Do not update modification times on device special files.  This option
171is useful on laptops or other systems that perform power management.
172.It Cm nocoredump
173Do not allow programs to create crash dumps (core files) on the file system.
174This option can be used to help protect sensitive
175data by keeping core files (which may contain sensitive data)
176from being created on insecure file systems.
177Only core files that would be created by program crashes are
178prevented by use of this flag; the behavior of
179.Xr savecore 8
180is not affected.
181.It Cm noexec
182Do not allow execution of any binaries on the mounted file system.
183This option is useful for a server that has file systems containing
184binaries for architectures other than its own.
185.It Cm nosuid
186Do not allow set-user-identifier or set-group-identifier bits to take effect.
187.It Cm rdonly
188The same as
189.Fl r ;
190mount the file system read-only (even the super-user may not write it).
191.It Cm softdep
192(FFS only) Mount the filesystem using soft-dependencies. This means that
193metadata will not be written immediately, but is written in an ordered fashion
194to keep the on-disk state of the filesystem consistent. This results
195in significant speedups for file create/delete operations. This option
196will be ignored when using the
197.Fl u
198flag and a filesystem is already mounted read/write. This option has gone
199through moderate to heavy testing, but should still be used with care.
200It requires the
201.Dv SOFTDEP
202option to be enabled in the running kernel.
203.It Cm symperm
204Recognize permission of symbolic link when reading or traversing link.
205.It Cm sync
206All
207.Tn I/O
208to the file system should be done synchronously. This is not equivalent to the
209normal mode in which only metadata is written synchronously.
210.It Cm nosync
211Clear
212.Cm sync
213mode.
214.It Cm update
215The same as
216.Fl u ;
217indicate that the status of an already mounted file system should be changed.
218.It Cm union
219Causes the namespace at the mount point to appear as the union
220of the mounted filesystem root and the existing directory.
221Lookups will be done in the mounted filesystem first.
222If those operations fail due to a non-existent file the underlying
223directory is then accessed.
224All creates are done in the mounted filesystem, except for the fdesc
225file system.
226.El
227.Pp
228Any additional options specific to a given filesystem type (see the
229.Fl t
230option) may be passed as a comma separated list; these options are
231distinguished by a leading
232.Dq \&-
233(dash).
234Options that take a value are specified using the syntax -option=value.
235For example, the mount command:
236.Bd -literal -offset indent
237mount -t mfs -o nosuid,-N,-s=32m swap /tmp
238.Ed
239.Pp
240causes
241.Nm
242to execute the equivalent of:
243.Bd -literal -offset indent
244/sbin/mount_mfs -o nosuid -N -s 32m swap /tmp
245.Ed
246.It Fl r
247The file system is to be mounted read-only.
248Mount the file system read-only (even the super-user may not write it).
249The same as the
250.Dq rdonly
251argument to the
252.Fl o
253option.
254.It Fl t Ar type
255The argument following the
256.Fl t
257is used to indicate the file system type.
258The type
259.Ar ffs
260is the default.
261The \fI-t\fP option can be used
262to indicate that the actions should only be taken on
263filesystems of the specified type.
264More than one type may be specified in a comma separated list.
265The list of filesystem types can be prefixed with
266.Dq no
267to specify the filesystem types for which action should
268.Em not
269be taken.
270For example, the
271.Nm
272command:
273.Bd -literal -offset indent
274mount -a -t nonfs,mfs
275.Ed
276.Pp
277mounts all filesystems except those of type
278.Tn NFS
279and
280.Tn MFS .
281.Pp
282.Nm
283will attempt to execute a program in
284.Pa /sbin/mount_ Ns Em XXX
285where
286.Em XXX
287is replaced by the type name.
288For example, nfs filesystems are mounted by the program
289.Pa /sbin/mount_nfs .
290.It Fl u
291The
292.Fl u
293flag indicates that the status of an already mounted file
294system should be changed.
295Any of the options discussed above (the
296.Fl o
297option)
298may be changed;
299also a file system can be changed from read-only to read-write
300or vice versa.
301An attempt to change from read-write to read-only will fail if any
302files on the filesystem are currently open for writing unless the
303.Fl f
304flag is also specified.
305The set of options is determined by first extracting the options
306for the file system from the
307.Xr fstab 5
308file, then applying any options specified by the
309.Fl o
310argument,
311and finally applying the
312.Fl r
313or
314.Fl w
315option.
316.It Fl v
317Verbose mode.
318.It Fl w
319The file system object is to be read and write.
320.El
321.Pp
322The options specific to the various file system types are
323described in the manual pages for those file systems'
324.Nm mount_XXX
325commands.
326For instance the options specific to Berkeley
327Fast File System (FFS) are described in the
328.Xr mount_ffs 8
329manual page.
330.Pp
331The particular type of filesystem in each partition of a disk can
332be found by examining the disk label with the
333.Xr disklabel 8
334command.
335.Sh FILES
336.Bl -tag -width /etc/fstab -compact
337.It Pa /etc/fstab
338file system table
339.El
340.Sh EXAMPLES
341Some useful examples:
342.Pp
343.Bl -hang -offset indent -width "MS-DOS"
344.It Tn CD-ROM
345.br
346mount -t cd9660 -r /dev/cd0a /cdrom
347.It Tn MS-DOS
348.br
349mount -t msdos /dev/fd0a /floppy
350.It Tn NFS
351.br
352mount nfs-server-host:/directory/path /mount-point
353.It Tn MFS (32 megabyte)
354.br
355mount -t mfs -o nosuid,-s=32m swap /tmp
356.El
357.Pp
358The "noauto" directive in
359.Pa /etc/fstab
360can be used to make it easy to manually mount and unmount removeable
361media using just the mountpoint filename, with an entry like this:
362.Pp
363.Dl /dev/cd0a  /cdrom  cd9660 ro,noauto 0 0
364.Pp
365That would allow a simple command like
366.Qq mount /cdrom
367or
368.Qq umount /cdrom
369for media using the
370.Tn ISO-9660
371filesystem format in the first
372.Tn CD-ROM
373drive.
374.Sh SEE ALSO
375.Xr mount 2 ,
376.Xr fstab 5 ,
377.Xr disklabel 8 ,
378.Xr mount_ados 8 ,
379.Xr mount_cd9660 8 ,
380.Xr mount_ext2fs 8 ,
381.Xr mount_fdesc 8 ,
382.Xr mount_ffs 8 ,
383.Xr mount_filecore 8 ,
384.Xr mount_kernfs 8 ,
385.Xr mount_lfs 8 ,
386.Xr mount_mfs 8 ,
387.Xr mount_msdos 8 ,
388.Xr mount_nfs 8 ,
389.Xr mount_ntfs 8 ,
390.Xr mount_null 8 ,
391.Xr mount_overlay 8 ,
392.Xr mount_portal 8 ,
393.Xr mount_procfs 8 ,
394.Xr mount_umap 8 ,
395.Xr mount_union 8 ,
396.Xr umount 8
397.Sh HISTORY
398A
399.Nm
400command appeared in
401.At v6 .
402