1 .\" Copyright (c) 1980, 1989, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)mount.2 8.3 (Berkeley) 5/24/95
37 .Nd mount or dismount a file system
44 .Fn mount "const char *type" "const char *dir" "int flags" "void *data"
46 .Fn unmount "const char *dir" "int flags"
49 .Fn nmount "struct iovec *iov" "u_int niov" "int flags"
54 a file system object onto the system file tree
59 describes the file system object to be mounted.
62 tells the kernel how to interpret
67 The contents of the file system
68 become available through the new mount point
73 of a successful mount are swept under the carpet so to speak, and
74 are unavailable until the file system is unmounted.
78 system call behaves similarly to
80 except that the mount options (file system type name, device to mount,
81 mount-point name, etc.) are passed as an array of name-value pairs
87 The following options are required by all file systems:
88 .Bl -column fstype -offset indent
90 .Li fstype Ta file system type name (e.g., Dq Li procfs )
92 .Li fspath Ta mount point pathname (e.g., Dq Li /proc )
95 Depending on the file system type, other options may be
96 recognized or required;
97 for example, most disk-based file systems require a
99 option containing the pathname of a special device
100 in addition to the options listed above.
102 By default only the super-user may call the
105 This restriction can be removed by setting the
109 to a non-zero value; see the BUGS section for more information.
114 suppress default semantics which affect file system access.
115 .Bl -tag -width MNT_SYNCHRONOUS
117 The file system should be treated as read-only;
118 even the super-user may not write on it.
119 Specifying MNT_UPDATE without this option will upgrade
120 a read-only file system to read/write.
122 Do not allow files to be executed from the file system.
124 Do not honor setuid or setgid bits on files when executing them.
125 This flag is set automatically when the caller is not the super-user.
127 Disable update of file access times.
129 Create a snapshot of the file system.
130 This is currently only supported on UFS2 file systems, see
132 for more information.
134 Directories with the SUID bit set chown new files to their own owner.
135 This flag requires the SUIDDIR option to have been compiled into the kernel
141 pages for more information.
142 .It Dv MNT_SYNCHRONOUS
143 All I/O to the file system should be done synchronously.
145 All I/O to the file system should be done asynchronously.
147 Force a read-write mount even if the file system appears to be unclean.
153 specify that the file system is to be forcibly downgraded to a read-only
154 mount even if some files are open for writing.
155 .It Dv MNT_NOCLUSTERR
156 Disable read clustering.
157 .It Dv MNT_NOCLUSTERW
158 Disable write clustering.
160 Do not mount over the root of another mount point.
162 Require an empty directory for the mount point directory.
167 indicates that the mount command is being applied
168 to an already mounted file system.
169 This allows the mount flags to be changed without requiring
170 that the file system be unmounted and remounted.
171 Some file systems may not allow all flags to be changed.
173 many file systems will not allow a change from read-write to read-only.
177 causes the vfs subsystem to update its data structures pertaining to
178 the specified already mounted file system.
182 argument names the file system.
183 The types of file systems known to the system can be obtained with
189 is a pointer to a structure that contains the type
190 specific arguments to mount.
191 The format for these argument structures is described in the
192 manual page for each file system.
193 By convention file system manual pages are named
194 by prefixing ``mount_'' to the name of the file system as returned by
198 file system is described by the
201 It should be noted that a manual page for default
202 file systems, known as UFS and UFS2, does not exist.
206 system call disassociates the file system from the specified
214 to specify that the file system should be forcibly unmounted
215 even if files are still active.
216 Active special devices continue to work,
217 but any further accesses to any other active files result in errors
218 even if the file system is later remounted.
224 should instead be a file system ID encoded as
225 .Dq Li FSID : Ns Ar val0 : Ns Ar val1 ,
230 are the contents of the
234 The file system that has the specified file system ID will be unmounted.
242 system calls will fail when one of the following occurs:
245 The caller is neither the super-user nor the owner of
247 .It Bq Er ENAMETOOLONG
248 A component of a pathname exceeded 255 characters,
249 or the entire length of a path name exceeded 1023 characters.
251 Too many symbolic links were encountered in translating a pathname.
264 Another process currently holds a reference to
269 option was given, and the requested mount point
270 is already the root of another mount point.
275 points outside the process's allocated address space.
277 An I/O error occurred while reading data from
280 The backing store for
282 detected corrupted data while reading.
285 The following errors can occur for a
290 A component of ufs_args
297 is not a block device.
301 option was specified, and the requested mount point
302 is not an empty directory.
304 The major device number of
306 is out of range (this indicates no device driver exists
307 for the associated hardware).
312 No space remains in the mount table.
314 The super block for the file system had a bad magic
315 number or an out of range block size.
317 The super block for the file system had a bad check hash.
318 The check hash can usually be corrected by running
321 Not enough memory was available to read the cylinder
322 group information for the file system.
324 An I/O error occurred while reading the super block or
325 cylinder group information.
330 points outside the process's allocated address space.
333 The following errors can occur for a
339 timed out trying to contact the server.
341 Some part of the information described by nfs_args
342 points outside the process's allocated address space.
347 system call may fail with one of the following errors:
350 The caller is neither the super-user nor the user who issued the corresponding
353 .It Bq Er ENAMETOOLONG
354 The length of the path name exceeded 1023 characters.
356 The requested directory is not in the mount table.
358 The file system ID specified using
360 was not found in the mount table.
362 The file system ID specified using
364 could not be decoded.
366 The specified file system is the root file system.
368 A process is holding a reference to a file located
371 An I/O error occurred while writing cached file system information.
376 points outside the process's allocated address space.
388 functions appeared in
392 system call first appeared in
395 Some of the error codes need translation to more obvious messages.
397 Allowing untrusted users to mount arbitrary media, e.g. by enabling
399 should not be considered safe.
402 were not built to safeguard against malicious devices.