]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/sys/mount.2
Fix whitespace in .Bd -literal display of S_IXXX constants.
[FreeBSD/FreeBSD.git] / lib / libc / sys / mount.2
1 .\" Copyright (c) 1980, 1989, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
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. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)mount.2     8.3 (Berkeley) 5/24/95
33 .\" $FreeBSD$
34 .\"
35 .Dd May 24, 1995
36 .Dt MOUNT 2
37 .Os
38 .Sh NAME
39 .Nm mount ,
40 .Nm unmount
41 .Nd mount or dismount a filesystem
42 .Sh LIBRARY
43 .Lb libc
44 .Sh SYNOPSIS
45 .In sys/param.h
46 .In sys/mount.h
47 .Ft int
48 .Fn mount "const char *type" "const char *dir" "int flags" "void *data"
49 .Ft int
50 .Fn unmount "const char *dir" "int flags"
51 .Sh DESCRIPTION
52 The
53 .Fn mount
54 function grafts
55 a filesystem object onto the system file tree
56 at the point
57 .Ar dir .
58 The argument
59 .Ar data
60 describes the filesystem object to be mounted.
61 The argument
62 .Ar type
63 tells the kernel how to interpret
64 .Ar data
65 (See
66 .Ar type
67 below).
68 The contents of the filesystem
69 become available through the new mount point
70 .Ar dir .
71 Any files in
72 .Ar dir
73 at the time
74 of a successful mount are swept under the carpet so to speak, and
75 are unavailable until the filesystem is unmounted.
76 .Pp
77 The following
78 .Ar flags
79 may be specified to
80 suppress default semantics which affect filesystem access.
81 .Bl -tag -width MNT_SYNCHRONOUS
82 .It Dv MNT_RDONLY
83 The filesystem should be treated as read-only;
84 Even the super-user may not write on it.
85 Specifying MNT_UPDATE without this option will upgrade
86 a read-only filesystem to read/write.
87 .It Dv MNT_NOEXEC
88 Do not allow files to be executed from the filesystem.
89 .It Dv MNT_NOSUID
90 Do not honor setuid or setgid bits on files when executing them.
91 .It Dv MNT_NOATIME
92 Disable update of file access times.
93 .It Dv MNT_NODEV
94 Do not interpret special files on the filesystem.
95 .It Dv MNT_SUIDDIR
96 Directories with the SUID bit set chown new files to their own owner.
97 .It Dv MNT_SYNCHRONOUS
98 All I/O to the filesystem should be done synchronously.
99 .It Dv MNT_ASYNC
100 All I/O to the filesystem should be done asynchronously.
101 .It Dv MNT_FORCE
102 Force a read-write mount even if the filesystem appears to be unclean.
103 Dangerous.
104 .It Dv MNT_NOCLUSTERR
105 Disable read clustering.
106 .It Dv MNT_NOCLUSTERW
107 Disable write clustering.
108 .El
109 .Pp
110 The flag
111 .Dv MNT_UPDATE
112 indicates that the mount command is being applied
113 to an already mounted filesystem.
114 This allows the mount flags to be changed without requiring
115 that the filesystem be unmounted and remounted.
116 Some filesystems may not allow all flags to be changed.
117 For example,
118 many filesystems will not allow a change from read-write to read-only.
119 .Pp
120 The flag
121 .Dv MNT_RELOAD
122 causes the vfs subsystem to update its data structures pertaining to
123 the specified already mounted filesystem.
124 .Pp
125 The
126 .Fa type
127 argument names the filesystem.
128 The types of filesystems known to the system can be obtained with
129 .Xr lsvfs 1 .
130 .Pp
131 .Fa Data
132 is a pointer to a structure that contains the type
133 specific arguments to mount.
134 The format for these argument structures is described in the
135 manual page for each filesystem.
136 By convention filesystem manual pages are named
137 by prefixing ``mount_'' to the name of the filesystem as returned by
138 .Xr lsvfs 1 .
139 Thus the
140 .Nm NFS
141 filesystem is described by the
142 .Xr mount_nfs 8
143 manual page.
144 .Pp
145 The
146 .Fn unmount
147 function call disassociates the filesystem from the specified
148 mount point
149 .Fa dir .
150 .Pp
151 The
152 .Fa flags
153 argument may specify
154 .Dv MNT_FORCE
155 to specify that the filesystem should be forcibly unmounted or made read-only
156 (if MNT_UPDATE and MNT_RDONLY are also specified)
157 even if files are still active.
158 Active special devices continue to work,
159 but any further accesses to any other active files result in errors
160 even if the filesystem is later remounted.
161 .Pp
162 The
163 .Dv MNT_SUIDDIR
164 option requires the SUIDDIR option to have been compiled into the kernel
165 to have any effect.
166 See the
167 .Xr mount 8
168 and
169 .Xr chmod 2
170 pages for more information.
171 .Sh RETURN VALUES
172 .Rv -std
173 .Sh ERRORS
174 The
175 .Fn mount
176 function will fail when one of the following occurs:
177 .Bl -tag -width Er
178 .It Bq Er EPERM
179 The caller is not the super-user.
180 .It Bq Er ENAMETOOLONG
181 A component of a pathname exceeded 255 characters,
182 or the entire length of a path name exceeded 1023 characters.
183 .It Bq Er ELOOP
184 Too many symbolic links were encountered in translating a pathname.
185 .It Bq Er ENOENT
186 A component of
187 .Fa dir
188 does not exist.
189 .It Bq Er ENOTDIR
190 A component of
191 .Ar name
192 is not a directory,
193 or a path prefix of
194 .Ar special
195 is not a directory.
196 .It Bq Er EBUSY
197 Another process currently holds a reference to
198 .Fa dir .
199 .It Bq Er EFAULT
200 .Fa Dir
201 points outside the process's allocated address space.
202 .El
203 .Pp
204 The following errors can occur for a
205 .Em ufs
206 filesystem mount:
207 .Bl -tag -width Er
208 .It Bq Er ENODEV
209 A component of ufs_args
210 .Ar fspec
211 does not exist.
212 .It Bq Er ENOTBLK
213 .Ar Fspec
214 is not a block device.
215 .It Bq Er ENXIO
216 The major device number of
217 .Ar fspec
218 is out of range (this indicates no device driver exists
219 for the associated hardware).
220 .It Bq Er EBUSY
221 .Ar Fspec
222 is already mounted.
223 .It Bq Er EMFILE
224 No space remains in the mount table.
225 .It Bq Er EINVAL
226 The super block for the filesystem had a bad magic
227 number or an out of range block size.
228 .It Bq Er ENOMEM
229 Not enough memory was available to read the cylinder
230 group information for the filesystem.
231 .It Bq Er EIO
232 An I/O error occurred while reading the super block or
233 cylinder group information.
234 .It Bq Er EFAULT
235 .Ar Fspec
236 points outside the process's allocated address space.
237 .El
238 .Pp
239 The following errors can occur for a
240 .Em nfs
241 filesystem mount:
242 .Bl -tag -width Er
243 .It Bq Er ETIMEDOUT
244 .Em Nfs
245 timed out trying to contact the server.
246 .It Bq Er EFAULT
247 Some part of the information described by nfs_args
248 points outside the process's allocated address space.
249 .El
250 .Pp
251 The
252 .Fn unmount
253 function may fail with one of the following errors:
254 .Bl -tag -width Er
255 .It Bq Er EPERM
256 The caller is not the super-user.
257 .It Bq Er ENOTDIR
258 A component of the path is not a directory.
259 .It Bq Er ENAMETOOLONG
260 A component of a pathname exceeded 255 characters,
261 or an entire path name exceeded 1023 characters.
262 .It Bq Er ELOOP
263 Too many symbolic links were encountered in translating the pathname.
264 .It Bq Er EINVAL
265 The requested directory is not in the mount table.
266 .It Bq Er EBUSY
267 A process is holding a reference to a file located
268 on the filesystem.
269 .It Bq Er EIO
270 An I/O error occurred while writing cached filesystem information.
271 .It Bq Er EFAULT
272 .Fa Dir
273 points outside the process's allocated address space.
274 .El
275 .Pp
276 A
277 .Em ufs
278 mount can also fail if the maximum number of filesystems are currently
279 mounted.
280 .Sh SEE ALSO
281 .Xr lsvfs 1 ,
282 .Xr mount 8 ,
283 .Xr umount 8
284 .Sh BUGS
285 Some of the error codes need translation to more obvious messages.
286 .Sh HISTORY
287 .Fn Mount
288 and
289 .Fn unmount
290 function calls appeared in
291 .At v6 .