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