1 .\" $NetBSD: mount.2,v 1.45 2010/05/31 12:16:20 njoly 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.
101 .It Dv MNT_NODEVMTIME
102 Never update modification time of device files.
104 Recognize the permission of symbolic link when reading or traversing.
105 .It Dv MNT_SYNCHRONOUS
106 All I/O to the file system should be done synchronously.
107 This will slow I/O performance considerably, but
108 enhances overall filesystem reliability.
110 All I/O to the file system should be done asynchronously.
111 This vastly improves I/O throughput,
112 but at a cost of making the filesystem likely to be
113 completely unrecoverable should the system crash while
114 unwritten data is pending in kernel buffers.
116 Use a filesystem journal.
118 causes a journal (or log) to be created in the
119 filesystem, creating a record of meta-data writes to be
120 performed, allowing the actual writes to be deferred.
121 This improves performance in most cases.
129 flags indicate that the mount command is being applied
130 to an already mounted file system.
133 flag allows the mount flags to be changed without requiring
134 that the file system be unmounted and remounted.
135 A conversion from read-write to read-only will fail if any files
136 are currently open for writing on the filesystem, unless the
138 flag is also applied.
139 Some file systems may not allow all flags to be changed.
141 some file systems will not allow a change from read-write to read-only.
144 flag causes kernel filesystem data to be reloaded from
145 the filesystem device.
146 It is only permitted on filesystems mounted read-only.
147 Its purpose is to notify the system that the filesystem
148 data has been modified by some external process.
151 flag does not alter any of the mounted filesystem's properties,
152 but returns the filesystem-specific arguments for the currently mounted
157 argument defines the type of the file system.
158 The types of file systems known to the system are defined in
160 and those supported by the current running kernel obtained
164 .\" .Bd -literal -offset indent
167 .\" The types of filesystems known to the system can be obtained with
169 .\" by using the command:
170 .\" .Bd -literal -offset indent
175 is a pointer to a structure that contains the type
176 specific arguments to mount.
177 Some of the currently supported types of file systems and
178 their type specific data are:
181 .Bd -literal -offset indent -compact
183 char *fspec; /* block special file to mount */
188 .Bd -literal -offset indent -compact
190 int version; /* args structure version */
191 struct sockaddr *addr; /* file server address */
192 int addrlen; /* length of address */
193 int sotype; /* Socket type */
194 int proto; /* and Protocol */
195 u_char *fh; /* File handle to be mounted */
196 int fhsize; /* Size, in bytes, of fh */
197 int flags; /* flags */
198 int wsize; /* write size in bytes */
199 int rsize; /* read size in bytes */
200 int readdirsize; /* readdir size in bytes */
201 int timeo; /* initial timeout in .1 secs */
202 int retrans; /* times to retry send */
203 int maxgrouplist; /* Max. size of group list */
204 int readahead; /* # of blocks to readahead */
205 int leaseterm; /* Term (sec) of lease */
206 int deadthresh; /* Retrans threshold */
207 char *hostname; /* server's name */
212 .Bd -literal -offset indent -compact
214 char *fspec; /* name to export for statfs */
215 struct export_args30 pad; /* unused */
216 caddr_t base; /* base of file system in mem */
217 u_long size; /* size of file system */
221 .\" The format for these argument structures is described in the
222 .\" manual page for each filesystem.
223 .\" By convention filesystem manual pages are named
224 .\" by prefixing ``mount_'' to the name of the filesystem as returned by
228 .\" filesystem is described by the
234 function call disassociates the file system from the specified
242 to specify that the file system should be forcibly unmounted even if files are
244 Active special devices continue to work,
245 but any further accesses to any other active files result in errors
246 even if the file system is later remounted.
249 returns the value 0 if the mount was successful,
250 the number of bytes written to
254 otherwise \-1 is returned and the variable
256 is set to indicate the error.
259 returns the value 0 if the unmount succeeded; otherwise \-1 is returned
262 is set to indicate the error.
265 will fail when one of the following occurs:
268 Another process currently holds a reference to
270 or for an update from read-write to read-only
271 there are files on the filesystem open for writes.
274 points outside the process's allocated address space.
276 Too many symbolic links were encountered in translating a pathname.
277 .It Bq Er ENAMETOOLONG
278 A component of a pathname exceeded
280 characters, or an entire path name exceeded
295 The caller is not the super-user,
296 and ordinary user mounts are not permitted or
297 this particular request violates the rules.
300 The following errors can occur for a
309 points outside the process's allocated address space.
311 The super block for the file system had a bad magic
312 number or an out of range block size.
314 An I/O error occurred while reading the super block or
315 cylinder group information.
317 No space remains in the mount table.
319 A component of ufs_args
323 Not enough memory was available to read the cylinder
324 group information for the file system.
327 is not a block device.
329 The major device number of
331 is out of range (this indicates no device driver exists
332 for the associated hardware).
335 The following errors can occur for a
340 Some part of the information described by nfs_args
341 points outside the process's allocated address space.
344 timed out trying to contact the server.
347 The following errors can occur for a
353 points outside the process's allocated address space.
355 The super block for the file system had a bad magic
356 number or an out of range block size.
358 A paging error occurred while reading the super block or
359 cylinder group information.
361 No space remains in the mount table.
363 Not enough memory was available to read the cylinder
364 group information for the file system.
368 may fail with one of the following errors:
371 A process is holding a reference to a file located
375 points outside the process's allocated address space.
377 The requested directory is not in the mount table.
379 An I/O error occurred while writing cached file system information.
381 Too many symbolic links were encountered in translating the pathname.
382 .It Bq Er ENAMETOOLONG
383 A component of a pathname exceeded
385 characters, or an entire path name exceeded
389 A component of the path is not a directory.
391 The caller is not the super-user.
398 mount can also fail if the maximum number of file systems are currently
416 function calls were all present in
423 call was used to export NFS filesystems.
424 This is now done through
429 argument was added for
432 Some of the error codes need translation to more obvious messages.
434 Far more filesystems are supported than those those listed.