1 .\" $OpenBSD: mount.2,v 1.6 1997/03/09 19:41:16 millert Exp $
2 .\" $NetBSD: mount.2,v 1.12 1996/02/29 23:47:48 jtc Exp $
4 .\" Copyright (c) 1980, 1989, 1993
5 .\" The Regents of the University of California. All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that the following conditions
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. All advertising materials mentioning features or use of this software
16 .\" must display the following acknowledgement:
17 .\" This product includes software developed by the University of
18 .\" California, Berkeley and its contributors.
19 .\" 4. Neither the name of the University nor the names of its contributors
20 .\" may be used to endorse or promote products derived from this software
21 .\" without specific prior written permission.
23 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .\" @(#)mount.2 8.2 (Berkeley) 12/11/93
44 .Nd mount or dismount a filesystem
46 .Fd #include <sys/param.h>
47 .Fd #include <sys/mount.h>
49 .Fn mount "const char *type" "const char *dir" "int flags" "void *data"
51 .Fn fmount "const char *type" "int fd" "int flags" "void *data"
53 .Fn unmount "const char *dir" "int flags"
58 a filesystem object onto the system file tree
63 describes the filesystem object to be mounted.
66 tells the kernel how to interpret
71 The contents of the filesystem
72 become available through the new mount point
77 of a successful mount are swept under the carpet so to speak, and
78 are unavailable until the filesystem is unmounted.
83 suppress default semantics which affect filesystem access.
84 .Bl -tag -width MNT_SYNCHRONOUS
86 The filesystem should be treated as read-only;
87 Even the super-user may not write on it.
89 Do not allow files to be executed from the filesystem.
91 Do not honor setuid or setgid bits on files when executing them.
93 Do not interpret special files on the filesystem.
95 Union with underlying filesystem instead of obscuring it.
96 .It Dv MNT_SYNCHRONOUS
97 All I/O to the filesystem should be done synchronously.
99 Enable data protection on the filesystem if the filesystem is configured for it.
104 indicates that the mount command is being applied
105 to an already mounted filesystem.
106 This allows the mount flags to be changed without requiring
107 that the filesystem be unmounted and remounted.
108 Some filesystems may not allow all flags to be changed.
110 most filesystems will not allow a change from read-write to read-only.
114 causes the vfs subsystem to update its data structures pertaining to
115 the specified already mounted filesystem.
119 argument defines the type of the filesystem.
122 is a pointer to a structure that contains the type
123 specific arguments to mount.
124 The format for these argument structures is described in the
125 manual page for each filesystem.
129 function call is equivalent to the
131 function call, except in the use of the second argument.
132 It takes an open file descriptor representing mount point
133 instead of the string literal containing full path to the mount
134 point in the filesystem hierarchy.
138 function call disassociates the filesystem from the specified
146 to specify that the filesystem should be forcibly unmounted even if files are
148 Active special devices continue to work,
149 but any further accesses to any other active files result in errors
150 even if the filesystem is later remounted.
156 return the value 0 if the mount was successful, otherwise -1 is returned
159 is set to indicate the error.
162 returns the value 0 if the unmount succeeded; otherwise -1 is returned
165 is set to indicate the error.
170 will fail when one of the following occurs:
171 .Bl -tag -width [ENAMETOOLONG]
173 The caller is not the super-user, and the device-node and the mountpoint
174 do not have adequate ownership and permissions.
175 .It Bq Er ENAMETOOLONG
176 A component of a pathname exceeded
178 characters, or an entire path name exceeded
182 Too many symbolic links were encountered in translating a pathname.
195 A pathname contains a character with the high-order bit set.
197 Another process currently holds a reference to
201 points outside the process's allocated address space.
205 may fail with one of the following errors:
206 .Bl -tag -width [ENAMETOOLONG]
208 The caller is not the super-user, and the
210 was not done by the user.
212 A component of the path is not a directory.
214 The pathname contains a character with the high-order bit set.
215 .It Bq Er ENAMETOOLONG
216 A component of a pathname exceeded
218 characters, or an entire path name exceeded
222 Too many symbolic links were encountered in translating the pathname.
224 The requested directory is not in the mount table.
226 A process is holding a reference to a file located
229 An I/O error occurred while writing cached filesystem information.
232 points outside the process's allocated address space.
239 Some of the error codes need translation to more obvious messages.
244 function calls appeared in
247 function call first appeared in macOS version 10.13.