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
43 .Nd mount or dismount a filesystem
45 .Fd #include <sys/param.h>
46 .Fd #include <sys/mount.h>
48 .Fn mount "const char *type" "const char *dir" "int flags" "void *data"
50 .Fn unmount "const char *dir" "int flags"
55 a filesystem object onto the system file tree
60 describes the filesystem object to be mounted.
63 tells the kernel how to interpret
68 The contents of the filesystem
69 become available through the new mount point
74 of a successful mount are swept under the carpet so to speak, and
75 are unavailable until the filesystem is unmounted.
80 suppress default semantics which affect filesystem access.
81 .Bl -tag -width MNT_SYNCHRONOUS
83 The filesystem should be treated as read-only;
84 Even the super-user may not write on it.
86 Do not update the access time on files in the filesystem unless
87 the modification or status change times are also being updated.
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.
102 indicates that the mount command is being applied
103 to an already mounted filesystem.
104 This allows the mount flags to be changed without requiring
105 that the filesystem be unmounted and remounted.
106 Some filesystems may not allow all flags to be changed.
108 most filesystems will not allow a change from read-write to read-only.
112 argument defines the type of the filesystem.
113 The types of filesystems known to the system are defined in
116 is a pointer to a structure that contains the type
117 specific arguments to mount.
118 The currently supported types of filesystems and
119 their type specific data are:
122 .Bd -literal -offset indent -compact
124 char *fspec; /* block special file to mount */
125 struct export_args export; /* network export information */
130 .Bd -literal -offset indent -compact
132 int version; /* args structure version */
133 struct sockaddr *addr; /* file server address */
134 int addrlen; /* length of address */
135 int sotype; /* Socket type */
136 int proto; /* and Protocol */
137 u_char *fh; /* File handle to be mounted */
138 int fhsize; /* Size, in bytes, of fh */
139 int flags; /* flags */
140 int wsize; /* write size in bytes */
141 int rsize; /* read size in bytes */
142 int readdirsize; /* readdir size in bytes */
143 int timeo; /* initial timeout in .1 secs */
144 int retrans; /* times to retry send */
145 int maxgrouplist; /* Max. size of group list */
146 int readahead; /* # of blocks to readahead */
147 int leaseterm; /* Term (sec) of lease */
148 int deadthresh; /* Retrans threshold */
149 char *hostname; /* server's name */
154 .Bd -literal -offset indent -compact
156 char *fspec; /* name to export for statfs */
157 struct export_args export; /* if we can export an MFS */
158 caddr_t base; /* base of filesystem in mem */
159 u_long size; /* size of filesystem */
165 function call disassociates the filesystem from the specified
173 to specify that the filesystem should be forcibly unmounted even if files are
175 Active special devices continue to work,
176 but any further accesses to any other active files result in errors
177 even if the filesystem is later remounted.
181 returns the value 0 if the mount was successful, otherwise -1 is returned
184 is set to indicate the error.
187 returns the value 0 if the umount succeeded; otherwise -1 is returned
190 is set to indicate the error.
193 will fail when one of the following occurs:
194 .Bl -tag -width [ENAMETOOLONG]
196 The caller is not the super-user.
197 .It Bq Er ENAMETOOLONG
198 A component of a pathname exceeded
200 characters, or an entire path name exceeded
204 Too many symbolic links were encountered in translating a pathname.
217 A pathname contains a character with the high-order bit set.
219 Another process currently holds a reference to
223 points outside the process's allocated address space.
226 The following errors can occur for a
229 .Bl -tag -width [ENOTBLK]
231 A component of ufs_args
236 is not a block device.
238 The major device number of
240 is out of range (this indicates no device driver exists
241 for the associated hardware).
246 No space remains in the mount table.
248 The super block for the filesystem had a bad magic
249 number or an out of range block size.
251 Not enough memory was available to read the cylinder
252 group information for the filesystem.
254 An I/O error occurred while reading the super block or
255 cylinder group information.
258 points outside the process's allocated address space.
261 The following errors can occur for a
264 .Bl -tag -width [ETIMEDOUT]
267 timed out trying to contact the server.
269 Some part of the information described by nfs_args
270 points outside the process's allocated address space.
273 The following errors can occur for a
276 .Bl -tag -width [EMFILE]
278 No space remains in the mount table.
280 The super block for the filesystem had a bad magic
281 number or an out of range block size.
283 Not enough memory was available to read the cylinder
284 group information for the filesystem.
286 A paging error occurred while reading the super block or
287 cylinder group information.
290 points outside the process's allocated address space.
294 may fail with one of the following errors:
295 .Bl -tag -width [ENAMETOOLONG]
297 The caller is not the super-user.
299 A component of the path is not a directory.
301 The pathname contains a character with the high-order bit set.
302 .It Bq Er ENAMETOOLONG
303 A component of a pathname exceeded
305 characters, or an entire path name exceeded
309 Too many symbolic links were encountered in translating the pathname.
311 The requested directory is not in the mount table.
313 A process is holding a reference to a file located
316 An I/O error occurred while writing cached filesystem information.
319 points outside the process's allocated address space.
326 mount can also fail if the maximum number of filesystems are currently
333 Some of the error codes need translation to more obvious messages.
338 function calls appeared in