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 | .\" | |
1b683cb2 | 16 | .\" @(#)mount.2 6.9 (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 */ | |
1b683cb2 KM |
98 | int exflags; /* export related flags */ |
99 | uid_t exroot; /* mapping for root uid */ | |
156f4461 KM |
100 | }; |
101 | .fi | |
102 | .sp | |
103 | .IP MOUNT_NFS 6 | |
104 | .nf | |
105 | struct nfs_args { | |
106 | struct sockaddr_in *addr; /* file server address */ | |
107 | nfsv2fh_t *fh; /* File handle to be mounted */ | |
108 | int flags; /* flags */ | |
109 | int wsize; /* write size in bytes */ | |
110 | int rsize; /* read size in bytes */ | |
111 | int timeo; /* initial timeout in 0.1 secs */ | |
112 | int retrans; /* times to retry send */ | |
113 | char *hostname; /* server's name */ | |
114 | }; | |
115 | .fi | |
537ddbbc KM |
116 | .IP MOUNT_MFS 6 |
117 | .nf | |
118 | struct mfs_args { | |
119 | char *name; /* name of backing process */ | |
120 | caddr_t base; /* base address of the file system */ | |
121 | u_long size; /* size of the file system */ | |
122 | }; | |
123 | .fi | |
124 | .sp | |
75f4d1ff KM |
125 | .PP |
126 | .I Umount | |
156f4461 KM |
127 | announces to the system that the file system mounted at |
128 | .I dir | |
129 | is no longer to contain that file system. | |
130 | The associated directory reverts to its ordinary interpretation. | |
131 | .PP | |
132 | The | |
133 | .I flags | |
134 | argument may have the following values: | |
135 | .IP MNT_NOFORCE 12 | |
136 | The unmount should fail if any files are active on the file system. | |
137 | .IP MNT_FORCE 12 | |
138 | The file system should be forcibly unmounted even if files are | |
139 | still active. | |
f8a965b6 KM |
140 | Active special devices continue to work, |
141 | but any further accesses to any other active files result in errors | |
156f4461 | 142 | even if the file system is later remounted. |
28e2febc | 143 | .SH "RETURN VALUE |
75f4d1ff | 144 | .I Mount |
156f4461 KM |
145 | returns 0 if the action occurred, \-1 if an error occurred. |
146 | The mount can fail if | |
147 | .I dir | |
148 | does not exist or is not a directory. | |
149 | For a | |
150 | .I ufs | |
151 | file system, the mount can fail if the special device | |
152 | specified in the ufs_args structure is | |
153 | inaccessible, is not an appropriate file, or is already mounted. | |
154 | A | |
155 | .I ufs | |
537ddbbc KM |
156 | or |
157 | .I mfs | |
156f4461 | 158 | mount can also fail if there are already too many |
75f4d1ff KM |
159 | file systems mounted. |
160 | .PP | |
161 | .I Umount | |
156f4461 KM |
162 | returns 0 if the action occurred; \-1 if an error occurred. |
163 | The unmount will fail | |
164 | if there are active files in the mounted file system. | |
28e2febc KM |
165 | .SH ERRORS |
166 | .I Mount | |
167 | will fail when one of the following occurs: | |
168 | .TP 15 | |
156f4461 KM |
169 | [EPERM] |
170 | The caller is not the super-user. | |
171 | .TP 15 | |
b5984ffe | 172 | [ENAMETOOLONG] |
156f4461 KM |
173 | A component of a pathname exceeded 255 characters, |
174 | or the entire length of a path name exceeded 1023 characters. | |
b5984ffe KM |
175 | .TP 15 |
176 | [ELOOP] | |
156f4461 | 177 | Too many symbolic links were encountered in translating a pathname. |
28e2febc | 178 | .TP 15 |
b5984ffe | 179 | [ENOENT] |
156f4461 KM |
180 | A component of \fIdir\fP does not exist. |
181 | .TP 15 | |
182 | [ENOTDIR] | |
183 | A component of \fIname\fP is not a directory, | |
184 | or a path prefix of \fIspecial\fP is not a directory. | |
185 | .TP 15 | |
186 | [EINVAL] | |
187 | A pathname contains a character with the high-order bit set. | |
188 | .TP 15 | |
189 | [EBUSY] | |
190 | Another process currently holds a reference to | |
191 | .IR dir . | |
192 | .TP 15 | |
193 | [EFAULT] | |
194 | \fIDir\fP points outside the process's allocated address space. | |
195 | .PP | |
196 | The following errors can occur for a | |
197 | .I ufs | |
198 | file system mount: | |
b5984ffe KM |
199 | .TP 15 |
200 | [ENODEV] | |
156f4461 | 201 | A component of ufs_args \fIfspec\fP does not exist. |
28e2febc KM |
202 | .TP 15 |
203 | [ENOTBLK] | |
156f4461 | 204 | .I Fspec |
28e2febc KM |
205 | is not a block device. |
206 | .TP 15 | |
207 | [ENXIO] | |
208 | The major device number of | |
156f4461 | 209 | .I fspec |
28e2febc KM |
210 | is out of range (this indicates no device driver exists |
211 | for the associated hardware). | |
212 | .TP 15 | |
156f4461 KM |
213 | [EBUSY] |
214 | \fIFspec\fP is already mounted. | |
28e2febc | 215 | .TP 15 |
156f4461 KM |
216 | [EMFILE] |
217 | No space remains in the mount table. | |
28e2febc | 218 | .TP 15 |
b5984ffe | 219 | [EINVAL] |
28e2febc KM |
220 | The super block for the file system had a bad magic |
221 | number or an out of range block size. | |
222 | .TP 15 | |
b5984ffe | 223 | [ENOMEM] |
28e2febc KM |
224 | Not enough memory was available to read the cylinder |
225 | group information for the file system. | |
226 | .TP 15 | |
b5984ffe | 227 | [EIO] |
fd690c8b | 228 | An I/O error occurred while reading the super block or |
28e2febc | 229 | cylinder group information. |
fd690c8b KM |
230 | .TP 15 |
231 | [EFAULT] | |
156f4461 KM |
232 | \fIFspec\fP points outside the process's allocated address space. |
233 | .PP | |
234 | The following errors can occur for a | |
235 | .I nfs | |
236 | file system mount: | |
237 | .TP 15 | |
238 | [ETIMEDOUT] | |
239 | .I Nfs | |
240 | timed out trying to contact the server. | |
241 | .TP 15 | |
242 | [EFAULT] | |
243 | Some part of the information described by nfs_args | |
244 | points outside the process's allocated address space. | |
75f4d1ff | 245 | .PP |
537ddbbc KM |
246 | The following errors can occur for a |
247 | .I mfs | |
248 | file system mount: | |
249 | .TP 15 | |
250 | [EMFILE] | |
251 | No space remains in the mount table. | |
252 | .TP 15 | |
253 | [EINVAL] | |
254 | The super block for the file system had a bad magic | |
255 | number or an out of range block size. | |
256 | .TP 15 | |
257 | [ENOMEM] | |
258 | Not enough memory was available to read the cylinder | |
259 | group information for the file system. | |
260 | .TP 15 | |
261 | [EIO] | |
262 | An paging error occurred while reading the super block or | |
263 | cylinder group information. | |
264 | .TP 15 | |
265 | [EFAULT] | |
266 | \fIName\fP points outside the process's allocated address space. | |
267 | .PP | |
28e2febc KM |
268 | .I Umount |
269 | may fail with one of the following errors: | |
270 | .TP 15 | |
156f4461 KM |
271 | [EPERM] |
272 | The caller is not the super-user. | |
273 | .TP 15 | |
b5984ffe | 274 | [ENOTDIR] |
156f4461 | 275 | A component of the path is not a directory. |
b5984ffe KM |
276 | .TP 15 |
277 | [EINVAL] | |
278 | The pathname contains a character with the high-order bit set. | |
279 | .TP 15 | |
280 | [ENAMETOOLONG] | |
281 | A component of a pathname exceeded 255 characters, | |
282 | or an entire path name exceeded 1023 characters. | |
283 | .TP 15 | |
284 | [ELOOP] | |
285 | Too many symbolic links were encountered in translating the pathname. | |
286 | .TP 15 | |
28e2febc | 287 | [EINVAL] |
156f4461 | 288 | The requested directory is not in the mount table. |
28e2febc KM |
289 | .TP 15 |
290 | [EBUSY] | |
291 | A process is holding a reference to a file located | |
292 | on the file system. | |
fd690c8b KM |
293 | .TP 15 |
294 | [EIO] | |
156f4461 | 295 | An I/O error occurred while writing cached file system information. |
fd690c8b KM |
296 | .TP 15 |
297 | [EFAULT] | |
156f4461 | 298 | \fIDir\fP points outside the process's allocated address space. |
28e2febc | 299 | .SH "SEE ALSO" |
537ddbbc | 300 | mount(8), umount(8), mfs(8) |
28e2febc | 301 | .SH BUGS |
b5984ffe | 302 | Some of the error codes need translation to more obvious messages. |