1 .\" $NetBSD: mount.2,v 1.49 2011/11/18 21:04:21 christos Exp $
3 .\" Copyright (c) 1980, 1989, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
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.
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
30 .\" @(#)mount.2 8.3 (Berkeley) 5/24/95
38 .Nd mount or dismount a file system
45 .Fn mount "const char *type" "const char *dir" "int flags" "void *data" "size_t data_len"
47 .Fn unmount "const char *dir" "int flags"
52 a file system object onto the system file tree
57 describes the file system object to be mounted, and is
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.
79 suppress default semantics which affect file system access.
80 .Bl -tag -width MNT_SYNCHRONOUS
82 The file system should be treated as read-only;
83 even the super-user may not write on it.
85 Union with underlying filesystem instead of obscuring it.
89 program, and perhaps others, to, by default,
90 exclude this filesystem from its output.
92 Do not allow files to be executed from the file system.
94 Do not honor setuid or setgid bits on files when executing them.
96 Do not interpret special files on the file system.
98 Do not allow programs to dump core files on the file system.
100 Never update access time in the file system.
102 Update access time on write and change.
103 This helps programs that verify that the file has been read after written
105 .It Dv MNT_NODEVMTIME
106 Never update modification time of device files.
108 Recognize the permission of symbolic link when reading or traversing.
109 .It Dv MNT_SYNCHRONOUS
110 All I/O to the file system should be done synchronously.
111 This will slow I/O performance considerably, but
112 enhances overall filesystem reliability.
114 All I/O to the file system should be done asynchronously.
115 This vastly improves I/O throughput,
116 but at a cost of making the filesystem likely to be
117 completely unrecoverable should the system crash while
118 unwritten data is pending in kernel buffers.
120 Use a filesystem journal.
122 causes a journal (or log) to be created in the
123 filesystem, creating a record of meta-data writes to be
124 performed, allowing the actual writes to be deferred.
125 This improves performance in most cases.
127 Enable extended attributes, if the filesystem supports them and
128 does not enable them by default.
129 Currently this is only the case for UFS1.
137 flags indicate that the mount command is being applied
138 to an already mounted file system.
141 flag allows the mount flags to be changed without requiring
142 that the file system be unmounted and remounted.
143 A conversion from read-write to read-only will fail if any files
144 are currently open for writing on the filesystem, unless the
146 flag is also applied.
147 Some file systems may not allow all flags to be changed.
149 some file systems will not allow a change from read-write to read-only.
152 flag causes kernel filesystem data to be reloaded from
153 the filesystem device.
154 It is only permitted on filesystems mounted read-only.
155 Its purpose is to notify the system that the filesystem
156 data has been modified by some external process.
159 flag does not alter any of the mounted filesystem's properties,
160 but returns the filesystem-specific arguments for the currently mounted
165 argument defines the type of the file system.
166 The types of file systems known to the system are defined in
168 and those supported by the current running kernel obtained
172 .\" .Bd -literal -offset indent
175 .\" The types of filesystems known to the system can be obtained with
177 .\" by using the command:
178 .\" .Bd -literal -offset indent
183 is a pointer to a structure that contains the type
184 specific arguments to mount.
185 Some of the currently supported types of file systems and
186 their type specific data are:
189 .Bd -literal -offset indent -compact
191 char *fspec; /* block special file to mount */
196 .Bd -literal -offset indent -compact
198 int version; /* args structure version */
199 struct sockaddr *addr; /* file server address */
200 int addrlen; /* length of address */
201 int sotype; /* Socket type */
202 int proto; /* and Protocol */
203 u_char *fh; /* File handle to be mounted */
204 int fhsize; /* Size, in bytes, of fh */
205 int flags; /* flags */
206 int wsize; /* write size in bytes */
207 int rsize; /* read size in bytes */
208 int readdirsize; /* readdir size in bytes */
209 int timeo; /* initial timeout in .1 secs */
210 int retrans; /* times to retry send */
211 int maxgrouplist; /* Max. size of group list */
212 int readahead; /* # of blocks to readahead */
213 int leaseterm; /* Term (sec) of lease */
214 int deadthresh; /* Retrans threshold */
215 char *hostname; /* server's name */
220 .Bd -literal -offset indent -compact
222 char *fspec; /* name to export for statfs */
223 struct export_args30 pad; /* unused */
224 caddr_t base; /* base of file system in mem */
225 u_long size; /* size of file system */
229 .\" The format for these argument structures is described in the
230 .\" manual page for each filesystem.
231 .\" By convention filesystem manual pages are named
232 .\" by prefixing ``mount_'' to the name of the filesystem as returned by
236 .\" filesystem is described by the
242 function call disassociates the file system from the specified
250 to specify that the file system should be forcibly unmounted even if files are
252 Active special devices continue to work,
253 but any further accesses to any other active files result in errors
254 even if the file system is later remounted.
257 returns the value 0 if the mount was successful,
258 the number of bytes written to
262 otherwise \-1 is returned and the variable
264 is set to indicate the error.
267 returns the value 0 if the unmount succeeded; otherwise \-1 is returned
270 is set to indicate the error.
273 will fail when one of the following occurs:
276 Another process currently holds a reference to
278 or for an update from read-write to read-only
279 there are files on the filesystem open for writes.
282 points outside the process's allocated address space.
284 Too many symbolic links were encountered in translating a pathname.
285 .It Bq Er ENAMETOOLONG
286 A component of a pathname exceeded
288 characters, or an entire path name exceeded
303 The caller is not the super-user,
304 and ordinary user mounts are not permitted or
305 this particular request violates the rules.
308 The following errors can occur for a
317 points outside the process's allocated address space.
319 The super block for the file system had a bad magic
320 number or an out of range block size.
322 An I/O error occurred while reading the super block or
323 cylinder group information.
325 No space remains in the mount table.
327 A component of ufs_args
331 Not enough memory was available to read the cylinder
332 group information for the file system.
335 is not a block device.
337 The major device number of
339 is out of range (this indicates no device driver exists
340 for the associated hardware).
343 The following errors can occur for a
348 Some part of the information described by nfs_args
349 points outside the process's allocated address space.
352 timed out trying to contact the server.
355 The following errors can occur for a
361 points outside the process's allocated address space.
363 The super block for the file system had a bad magic
364 number or an out of range block size.
366 A paging error occurred while reading the super block or
367 cylinder group information.
369 No space remains in the mount table.
371 Not enough memory was available to read the cylinder
372 group information for the file system.
376 may fail with one of the following errors:
379 A process is holding a reference to a file located
383 points outside the process's allocated address space.
385 The requested directory is not in the mount table.
387 An I/O error occurred while writing cached file system information.
389 Too many symbolic links were encountered in translating the pathname.
390 .It Bq Er ENAMETOOLONG
391 A component of a pathname exceeded
393 characters, or an entire path name exceeded
397 A component of the path is not a directory.
399 The caller is not the super-user.
406 mount can also fail if the maximum number of file systems are currently
424 function calls were all present in
431 call was used to export NFS filesystems.
432 This is now done through
437 argument was added for
440 Some of the error codes need translation to more obvious messages.
442 Far more filesystems are supported than those those listed.