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