xref: /netbsd/sbin/mount/mount.8 (revision c4a72b64)
1.\"	$NetBSD: mount.8,v 1.39 2002/11/07 12:45:35 wiz 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.
68The provided argument is looked up first in the
69.Dq fs_file ,
70then in the
71.Dq fs_spec
72column.
73If both
74.Ar special
75and
76.Ar node
77are given, the disklabel is checked for the filesystem type.
78.Pp
79In
80.Nx ,
81a file system can only be mounted by an ordinary user who owns the
82point
83.Ar node
84and has access to the
85.Ar special
86device (at least read permissions).
87In addition, the
88.Em vfs.generic.usermount
89.Xr sysctl 3
90must be set to 1 to permit file system mounting by ordinary users.
91See also
92.Xr sysctl 8 .
93.Pp
94The system maintains a list of currently mounted file systems.
95If no arguments are given to
96.Nm "" ,
97this list is printed.
98.Pp
99The options are as follows:
100.Bl -tag -width indent
101.It Fl A
102Causes
103.Nm
104to try to mount all of the file systems listed in the
105.Xr fstab 5
106file except those for which the
107.Dq noauto
108option is specified.
109.It Fl a
110Similar to the
111.Fl A
112flag, except that if a file system (other than the root file system)
113appears to be already mounted,
114.Nm
115will not try to mount it again.
116.Nm
117assumes that a file system is already mounted if a file system with
118the same type is mounted on the given mount point.
119More stringent checks are not possible because some file system types
120report strange values for the mounted-from device for mounted file
121systems.
122.It Fl d
123Causes everything to be done except for the invocation of
124the filesystem-specific program.
125This option is useful in conjunction with the
126.Fl v
127flag to determine what the
128.Nm
129command is trying to do.
130.It Fl f
131Forces the revocation of write access when trying to downgrade
132a filesystem mount status from read-write to read-only.
133.It Fl o
134Options are specified with a
135.Fl o
136flag followed by a comma separated string of options.
137The following options are available:
138.Bl -tag -width nocoredump
139.It Cm async
140All
141.Tn I/O
142to the file system should be done asynchronously.
143In the event of a crash,
144.Em "it is impossible for the system to verify the integrity of data on a file system mounted with this option" .
145You should only use this option if you have an application-specific data
146recovery mechanism, or are willing to recreate the file system from scratch.
147.It Cm noasync
148Clear
149.Cm async
150mode.
151.It Cm force
152The same as
153.Fl f ;
154forces the revocation of write access when trying to downgrade
155a filesystem mount status from read-write to read-only.
156.It Cm getargs
157Retrieves the filesystem specific mount arguments for the given
158mounted filesystem and prints them.
159.It Cm noatime
160Never update the access time field for files.
161This option is useful for optimizing read performance on filesystems
162that are used as news spools.
163.It Cm noauto
164This filesystem should be skipped when mount is run with the
165.Fl a
166flag.
167.It Cm nodev
168Do not interpret character or block special devices on the file system.
169This option is useful for a server that has file systems containing
170special devices for architectures other than its own.
171.It Cm nodevmtime
172Do not update modification times on device special files.
173This option is useful on laptops
174or other systems that perform power management.
175.It Cm nocoredump
176Do not allow programs to create crash dumps (core files) on the file system.
177This option can be used to help protect sensitive
178data by keeping core files (which may contain sensitive data)
179from being created on insecure file systems.
180Only core files that would be created by program crashes are
181prevented by use of this flag; the behavior of
182.Xr savecore 8
183is not affected.
184.It Cm noexec
185Do not allow execution of any binaries on the mounted file system.
186This option is useful for a server that has file systems containing
187binaries for architectures other than its own.
188.It Cm hidden
189By setting the
190.Dv MNT_IGNORE
191flag,
192causes the mount point to be excluded from the
193list of filesystems shown by default with
194.Xr df 1 .
195.It Cm nosuid
196Do not allow set-user-identifier or set-group-identifier bits to take effect.
197.It Cm rdonly
198The same as
199.Fl r ;
200mount the file system read-only (even the super-user may not write it).
201.It Cm softdep
202(FFS only) Mount the filesystem using soft-dependencies.
203This means that metadata will not be written immediately,
204but is written in an ordered fashion to keep the
205on-disk state of the filesystem consistent.
206This results in significant speedups for file create/delete operations.
207This option will be ignored when using the
208.Fl u
209flag and a filesystem is already mounted read/write.
210This option has gone through moderate to heavy testing,
211but should still be used with care.
212It requires the
213.Dv SOFTDEP
214option to be enabled in the running kernel.
215.It Cm symperm
216Recognize permission of symbolic link when reading or traversing link.
217.It Cm sync
218All
219.Tn I/O
220to the file system should be done synchronously.
221This is not equivalent to the normal mode in which only
222metadata is written synchronously.
223.It Cm nosync
224Clear
225.Cm sync
226mode.
227.It Cm update
228The same as
229.Fl u ;
230indicate that the status of an already mounted file system should be changed.
231.It Cm union
232Causes the namespace at the mount point to appear as the union
233of the mounted filesystem root and the existing directory.
234Lookups will be done in the mounted filesystem first.
235If those operations fail due to a non-existent file the underlying
236directory is then accessed.
237All creates are done in the mounted filesystem, except for the fdesc
238file system.
239.El
240.Pp
241Any additional options specific to a given filesystem type (see the
242.Fl t
243option) may be passed as a comma separated list; these options are
244distinguished by a leading
245.Dq \&-
246(dash).
247Options that take a value are specified using the syntax -option=value.
248For example, the mount command:
249.Bd -literal -offset indent
250mount -t mfs -o nosuid,-N,-s=32m swap /tmp
251.Ed
252.Pp
253causes
254.Nm
255to execute the equivalent of:
256.Bd -literal -offset indent
257/sbin/mount_mfs -o nosuid -N -s 32m swap /tmp
258.Ed
259.It Fl r
260The file system is to be mounted read-only.
261Mount the file system read-only (even the super-user may not write it).
262The same as the
263.Dq rdonly
264argument to the
265.Fl o
266option.
267.It Fl t Ar type
268The argument following the
269.Fl t
270is used to indicate the file system type.
271The type
272.Ar ffs
273is the default.
274The
275.Fl t
276option can be used to indicate that the actions
277should only be taken on filesystems of the specified type.
278More than one type may be specified in a comma separated list.
279The list of filesystem types can be prefixed with
280.Dq no
281to specify the filesystem types for which action should
282.Em not
283be taken.
284For example, the
285.Nm
286command:
287.Bd -literal -offset indent
288mount -a -t nonfs,mfs
289.Ed
290.Pp
291mounts all filesystems except those of type
292.Tn NFS
293and
294.Tn MFS .
295.Pp
296.Nm
297will attempt to execute a program in
298.Pa /sbin/mount_ Ns Em XXX
299where
300.Em XXX
301is replaced by the type name.
302For example, nfs filesystems are mounted by the program
303.Pa /sbin/mount_nfs .
304.It Fl u
305The
306.Fl u
307flag indicates that the status of an already mounted file
308system should be changed.
309Any of the options discussed above (the
310.Fl o
311option)
312may be changed;
313also a file system can be changed from read-only to read-write
314or vice versa.
315An attempt to change from read-write to read-only will fail if any
316files on the filesystem are currently open for writing unless the
317.Fl f
318flag is also specified.
319The set of options is determined by first extracting the options
320for the file system from the
321.Xr fstab 5
322file, then applying any options specified by the
323.Fl o
324argument,
325and finally applying the
326.Fl r
327or
328.Fl w
329option.
330.It Fl v
331Verbose mode.
332If this flag is specified more than once, then the
333filesystem-specific mount arguments are printed for the given mounted
334filesystem.
335.It Fl w
336The file system object is to be read and write.
337.El
338.Pp
339The options specific to the various file system types are
340described in the manual pages for those file systems'
341.Nm mount_XXX
342commands.
343For instance the options specific to Berkeley
344Fast File System (FFS) are described in the
345.Xr mount_ffs 8
346manual page.
347.Pp
348The particular type of filesystem in each partition of a disk can
349be found by examining the disk label with the
350.Xr disklabel 8
351command.
352.Sh FILES
353.Bl -tag -width /etc/fstab -compact
354.It Pa /etc/fstab
355file system table
356.El
357.Sh EXAMPLES
358Some useful examples:
359.Pp
360.Bl -hang -offset indent -width "MS-DOS"
361.It Tn CD-ROM
362.br
363mount -t cd9660 -r /dev/cd0a /cdrom
364.It Tn MS-DOS
365.br
366mount -t msdos /dev/fd0a /floppy
367.It Tn NFS
368.br
369mount nfs-server-host:/directory/path /mount-point
370.It Tn MFS (32 megabyte)
371.br
372mount -t mfs -o nosuid,-s=32m swap /tmp
373.El
374.Pp
375The "noauto" directive in
376.Pa /etc/fstab
377can be used to make it easy to manually mount and unmount removeable
378media using just the mountpoint filename, with an entry like this:
379.Pp
380.Dl /dev/cd0a  /cdrom  cd9660 ro,noauto 0 0
381.Pp
382That would allow a simple command like
383.Qq mount /cdrom
384or
385.Qq umount /cdrom
386for media using the
387.Tn ISO-9660
388filesystem format in the first
389.Tn CD-ROM
390drive.
391.Sh SEE ALSO
392.Xr df 1 ,
393.Xr mount 2 ,
394.Xr fstab 5 ,
395.Xr disklabel 8 ,
396.Xr mount_ados 8 ,
397.Xr mount_cd9660 8 ,
398.Xr mount_ext2fs 8 ,
399.Xr mount_fdesc 8 ,
400.Xr mount_ffs 8 ,
401.Xr mount_filecore 8 ,
402.Xr mount_kernfs 8 ,
403.Xr mount_lfs 8 ,
404.Xr mount_mfs 8 ,
405.Xr mount_msdos 8 ,
406.Xr mount_nfs 8 ,
407.Xr mount_ntfs 8 ,
408.Xr mount_null 8 ,
409.Xr mount_overlay 8 ,
410.Xr mount_portal 8 ,
411.Xr mount_procfs 8 ,
412.Xr mount_umap 8 ,
413.Xr mount_union 8 ,
414.Xr umount 8
415.Sh HISTORY
416A
417.Nm
418command appeared in
419.At v6 .
420