Commit | Line | Data |
---|---|---|
156f4461 KM |
1 | .\" Copyright (c) 1980, 1989 The Regents of the University of California. |
2 | .\" All rights reserved. | |
75f4d1ff | 3 | .\" |
156f4461 KM |
4 | .\" Redistribution and use in source and binary forms are permitted |
5 | .\" provided that the above copyright notice and this paragraph are | |
6 | .\" duplicated in all such forms and that any documentation, | |
7 | .\" advertising materials, and other materials related to such | |
8 | .\" distribution and use acknowledge that the software was developed | |
9 | .\" by the University of California, Berkeley. The name of the | |
10 | .\" University may not be used to endorse or promote products derived | |
11 | .\" from this software without specific prior written permission. | |
12 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
13 | .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
14 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
15 | .\" | |
eb9b2c86 | 16 | .\" @(#)mount.2 6.8 (Berkeley) %G% |
75f4d1ff | 17 | .\" |
acbf19e9 | 18 | .TH MOUNT 2 "" |
75f4d1ff KM |
19 | .UC 4 |
20 | .SH NAME | |
eb9b2c86 | 21 | mount, unmount \- mount or remove file system |
75f4d1ff KM |
22 | .SH SYNOPSIS |
23 | .nf | |
156f4461 KM |
24 | #include <sys/mount.h> |
25 | .sp | |
28e2febc | 26 | .ft B |
156f4461 KM |
27 | mount(type, dir, flags, data) |
28 | int type; | |
29 | char *dir; | |
30 | int flags; | |
31 | caddr_t data; | |
75f4d1ff | 32 | .PP |
28e2febc | 33 | .ft B |
eb9b2c86 | 34 | unmount(dir, flags) |
156f4461 KM |
35 | char *dir; |
36 | int flags; | |
75f4d1ff KM |
37 | .fi |
38 | .SH DESCRIPTION | |
39 | .I Mount | |
156f4461 KM |
40 | announces to the system that a file system has |
41 | been mounted on the directory | |
42 | .IR dir ; | |
43 | following the mount, references to directory | |
44 | .I dir | |
75f4d1ff | 45 | will refer to |
156f4461 KM |
46 | the root directory on the newly mounted file system. |
47 | .I Dir | |
48 | is a pointer to a null-terminated string | |
49 | containing the appropriate path name | |
50 | which must be a directory that already exists. | |
51 | Its old contents are inaccessible while the | |
52 | file system is mounted. | |
75f4d1ff KM |
53 | .PP |
54 | The | |
156f4461 KM |
55 | .I flag |
56 | argument determines whether certain semantics should be | |
57 | suppressed when accessing the file system: | |
58 | .IP M_RDONLY 14 | |
59 | The file system should be treated as read-only; | |
60 | no writing is allowed (even by the super-user). | |
75f4d1ff KM |
61 | Physically write-protected and magnetic |
62 | tape file systems must be mounted read-only or | |
63 | errors will occur when access times are updated, | |
64 | whether or not any | |
65 | explicit write is attempted. | |
156f4461 KM |
66 | .IP M_NOEXEC 14 |
67 | Do not allow files to be executed from the file system. | |
68 | .IP M_NOSUID 14 | |
537ddbbc | 69 | Do not honor setuid or setgid bits on files when executing them. |
156f4461 KM |
70 | .IP M_NODEV 14 |
71 | Do not interpret special files on the file system. | |
72 | .IP M_SYNCHRONOUS 14 | |
73 | All I/O to the file system should be done synchronously. | |
74 | .PP | |
f8865310 KM |
75 | The flag M_UPDATE indicates that the mount command is being applied |
76 | to an already mounted file system. | |
77 | This allows the mount flags to be changed without requiring | |
78 | that the file system be unmounted and remounted. | |
79 | Some file systems may not allow all flags to be changed. | |
80 | For example, | |
81 | most file systems will not allow a change from read-write to read-only. | |
82 | .PP | |
156f4461 KM |
83 | The |
84 | .I type | |
85 | argument defines the type of the file system. | |
86 | The types of file systems known to the system are defined in | |
537ddbbc | 87 | .IR mount.h . |
156f4461 KM |
88 | .I Data |
89 | is a pointer to a structure that contains the type | |
90 | specific arguments to mount. | |
91 | The currently supported types of file systems and | |
92 | their type specific data are: | |
93 | .IP MOUNT_UFS 6 | |
94 | .nf | |
95 | .ta \w'struct 'u +\w'nfsv2fh_t 'u +\w'sockaddr_in *addr 'u | |
96 | struct ufs_args { | |
97 | char *fspec; /* Block special file to mount */ | |
98 | }; | |
99 | .fi | |
100 | .sp | |
101 | .IP MOUNT_NFS 6 | |
102 | .nf | |
103 | struct nfs_args { | |
104 | struct sockaddr_in *addr; /* file server address */ | |
105 | nfsv2fh_t *fh; /* File handle to be mounted */ | |
106 | int flags; /* flags */ | |
107 | int wsize; /* write size in bytes */ | |
108 | int rsize; /* read size in bytes */ | |
109 | int timeo; /* initial timeout in 0.1 secs */ | |
110 | int retrans; /* times to retry send */ | |
111 | char *hostname; /* server's name */ | |
112 | }; | |
113 | .fi | |
537ddbbc KM |
114 | .IP MOUNT_MFS 6 |
115 | .nf | |
116 | struct mfs_args { | |
117 | char *name; /* name of backing process */ | |
118 | caddr_t base; /* base address of the file system */ | |
119 | u_long size; /* size of the file system */ | |
120 | }; | |
121 | .fi | |
122 | .sp | |
75f4d1ff KM |
123 | .PP |
124 | .I Umount | |
156f4461 KM |
125 | announces to the system that the file system mounted at |
126 | .I dir | |
127 | is no longer to contain that file system. | |
128 | The associated directory reverts to its ordinary interpretation. | |
129 | .PP | |
130 | The | |
131 | .I flags | |
132 | argument may have the following values: | |
133 | .IP MNT_NOFORCE 12 | |
134 | The unmount should fail if any files are active on the file system. | |
135 | .IP MNT_FORCE 12 | |
136 | The file system should be forcibly unmounted even if files are | |
137 | still active. | |
f8a965b6 KM |
138 | Active special devices continue to work, |
139 | but any further accesses to any other active files result in errors | |
156f4461 | 140 | even if the file system is later remounted. |
28e2febc | 141 | .SH "RETURN VALUE |
75f4d1ff | 142 | .I Mount |
156f4461 KM |
143 | returns 0 if the action occurred, \-1 if an error occurred. |
144 | The mount can fail if | |
145 | .I dir | |
146 | does not exist or is not a directory. | |
147 | For a | |
148 | .I ufs | |
149 | file system, the mount can fail if the special device | |
150 | specified in the ufs_args structure is | |
151 | inaccessible, is not an appropriate file, or is already mounted. | |
152 | A | |
153 | .I ufs | |
537ddbbc KM |
154 | or |
155 | .I mfs | |
156f4461 | 156 | mount can also fail if there are already too many |
75f4d1ff KM |
157 | file systems mounted. |
158 | .PP | |
159 | .I Umount | |
156f4461 KM |
160 | returns 0 if the action occurred; \-1 if an error occurred. |
161 | The unmount will fail | |
162 | if there are active files in the mounted file system. | |
28e2febc KM |
163 | .SH ERRORS |
164 | .I Mount | |
165 | will fail when one of the following occurs: | |
166 | .TP 15 | |
156f4461 KM |
167 | [EPERM] |
168 | The caller is not the super-user. | |
169 | .TP 15 | |
b5984ffe | 170 | [ENAMETOOLONG] |
156f4461 KM |
171 | A component of a pathname exceeded 255 characters, |
172 | or the entire length of a path name exceeded 1023 characters. | |
b5984ffe KM |
173 | .TP 15 |
174 | [ELOOP] | |
156f4461 | 175 | Too many symbolic links were encountered in translating a pathname. |
28e2febc | 176 | .TP 15 |
b5984ffe | 177 | [ENOENT] |
156f4461 KM |
178 | A component of \fIdir\fP does not exist. |
179 | .TP 15 | |
180 | [ENOTDIR] | |
181 | A component of \fIname\fP is not a directory, | |
182 | or a path prefix of \fIspecial\fP is not a directory. | |
183 | .TP 15 | |
184 | [EINVAL] | |
185 | A pathname contains a character with the high-order bit set. | |
186 | .TP 15 | |
187 | [EBUSY] | |
188 | Another process currently holds a reference to | |
189 | .IR dir . | |
190 | .TP 15 | |
191 | [EFAULT] | |
192 | \fIDir\fP points outside the process's allocated address space. | |
193 | .PP | |
194 | The following errors can occur for a | |
195 | .I ufs | |
196 | file system mount: | |
b5984ffe KM |
197 | .TP 15 |
198 | [ENODEV] | |
156f4461 | 199 | A component of ufs_args \fIfspec\fP does not exist. |
28e2febc KM |
200 | .TP 15 |
201 | [ENOTBLK] | |
156f4461 | 202 | .I Fspec |
28e2febc KM |
203 | is not a block device. |
204 | .TP 15 | |
205 | [ENXIO] | |
206 | The major device number of | |
156f4461 | 207 | .I fspec |
28e2febc KM |
208 | is out of range (this indicates no device driver exists |
209 | for the associated hardware). | |
210 | .TP 15 | |
156f4461 KM |
211 | [EBUSY] |
212 | \fIFspec\fP is already mounted. | |
28e2febc | 213 | .TP 15 |
156f4461 KM |
214 | [EMFILE] |
215 | No space remains in the mount table. | |
28e2febc | 216 | .TP 15 |
b5984ffe | 217 | [EINVAL] |
28e2febc KM |
218 | The super block for the file system had a bad magic |
219 | number or an out of range block size. | |
220 | .TP 15 | |
b5984ffe | 221 | [ENOMEM] |
28e2febc KM |
222 | Not enough memory was available to read the cylinder |
223 | group information for the file system. | |
224 | .TP 15 | |
b5984ffe | 225 | [EIO] |
fd690c8b | 226 | An I/O error occurred while reading the super block or |
28e2febc | 227 | cylinder group information. |
fd690c8b KM |
228 | .TP 15 |
229 | [EFAULT] | |
156f4461 KM |
230 | \fIFspec\fP points outside the process's allocated address space. |
231 | .PP | |
232 | The following errors can occur for a | |
233 | .I nfs | |
234 | file system mount: | |
235 | .TP 15 | |
236 | [ETIMEDOUT] | |
237 | .I Nfs | |
238 | timed out trying to contact the server. | |
239 | .TP 15 | |
240 | [EFAULT] | |
241 | Some part of the information described by nfs_args | |
242 | points outside the process's allocated address space. | |
75f4d1ff | 243 | .PP |
537ddbbc KM |
244 | The following errors can occur for a |
245 | .I mfs | |
246 | file system mount: | |
247 | .TP 15 | |
248 | [EMFILE] | |
249 | No space remains in the mount table. | |
250 | .TP 15 | |
251 | [EINVAL] | |
252 | The super block for the file system had a bad magic | |
253 | number or an out of range block size. | |
254 | .TP 15 | |
255 | [ENOMEM] | |
256 | Not enough memory was available to read the cylinder | |
257 | group information for the file system. | |
258 | .TP 15 | |
259 | [EIO] | |
260 | An paging error occurred while reading the super block or | |
261 | cylinder group information. | |
262 | .TP 15 | |
263 | [EFAULT] | |
264 | \fIName\fP points outside the process's allocated address space. | |
265 | .PP | |
28e2febc KM |
266 | .I Umount |
267 | may fail with one of the following errors: | |
268 | .TP 15 | |
156f4461 KM |
269 | [EPERM] |
270 | The caller is not the super-user. | |
271 | .TP 15 | |
b5984ffe | 272 | [ENOTDIR] |
156f4461 | 273 | A component of the path is not a directory. |
b5984ffe KM |
274 | .TP 15 |
275 | [EINVAL] | |
276 | The pathname contains a character with the high-order bit set. | |
277 | .TP 15 | |
278 | [ENAMETOOLONG] | |
279 | A component of a pathname exceeded 255 characters, | |
280 | or an entire path name exceeded 1023 characters. | |
281 | .TP 15 | |
282 | [ELOOP] | |
283 | Too many symbolic links were encountered in translating the pathname. | |
284 | .TP 15 | |
28e2febc | 285 | [EINVAL] |
156f4461 | 286 | The requested directory is not in the mount table. |
28e2febc KM |
287 | .TP 15 |
288 | [EBUSY] | |
289 | A process is holding a reference to a file located | |
290 | on the file system. | |
fd690c8b KM |
291 | .TP 15 |
292 | [EIO] | |
156f4461 | 293 | An I/O error occurred while writing cached file system information. |
fd690c8b KM |
294 | .TP 15 |
295 | [EFAULT] | |
156f4461 | 296 | \fIDir\fP points outside the process's allocated address space. |
28e2febc | 297 | .SH "SEE ALSO" |
537ddbbc | 298 | mount(8), umount(8), mfs(8) |
28e2febc | 299 | .SH BUGS |
b5984ffe | 300 | Some of the error codes need translation to more obvious messages. |