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 | .\" | |
16 | .\" @(#)mount.2 6.4 (Berkeley) %G% | |
75f4d1ff | 17 | .\" |
acbf19e9 | 18 | .TH MOUNT 2 "" |
75f4d1ff KM |
19 | .UC 4 |
20 | .SH NAME | |
21 | mount, umount \- mount or remove file system | |
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 |
156f4461 KM |
34 | umount(dir, flags) |
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 | |
69 | Do not honor setuid bits on files when executing them. | |
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 | |
75 | The | |
76 | .I type | |
77 | argument defines the type of the file system. | |
78 | The types of file systems known to the system are defined in | |
79 | .I mount.h . | |
80 | .I Data | |
81 | is a pointer to a structure that contains the type | |
82 | specific arguments to mount. | |
83 | The currently supported types of file systems and | |
84 | their type specific data are: | |
85 | .IP MOUNT_UFS 6 | |
86 | .nf | |
87 | .ta \w'struct 'u +\w'nfsv2fh_t 'u +\w'sockaddr_in *addr 'u | |
88 | struct ufs_args { | |
89 | char *fspec; /* Block special file to mount */ | |
90 | }; | |
91 | .fi | |
92 | .sp | |
93 | .IP MOUNT_NFS 6 | |
94 | .nf | |
95 | struct nfs_args { | |
96 | struct sockaddr_in *addr; /* file server address */ | |
97 | nfsv2fh_t *fh; /* File handle to be mounted */ | |
98 | int flags; /* flags */ | |
99 | int wsize; /* write size in bytes */ | |
100 | int rsize; /* read size in bytes */ | |
101 | int timeo; /* initial timeout in 0.1 secs */ | |
102 | int retrans; /* times to retry send */ | |
103 | char *hostname; /* server's name */ | |
104 | }; | |
105 | .fi | |
75f4d1ff KM |
106 | .PP |
107 | .I Umount | |
156f4461 KM |
108 | announces to the system that the file system mounted at |
109 | .I dir | |
110 | is no longer to contain that file system. | |
111 | The associated directory reverts to its ordinary interpretation. | |
112 | .PP | |
113 | The | |
114 | .I flags | |
115 | argument may have the following values: | |
116 | .IP MNT_NOFORCE 12 | |
117 | The unmount should fail if any files are active on the file system. | |
118 | .IP MNT_FORCE 12 | |
119 | The file system should be forcibly unmounted even if files are | |
120 | still active. | |
121 | Any further accesses to the active files results in errors | |
122 | even if the file system is later remounted. | |
123 | This flag is not currently supported on any file system type. | |
28e2febc | 124 | .SH "RETURN VALUE |
75f4d1ff | 125 | .I Mount |
156f4461 KM |
126 | returns 0 if the action occurred, \-1 if an error occurred. |
127 | The mount can fail if | |
128 | .I dir | |
129 | does not exist or is not a directory. | |
130 | For a | |
131 | .I ufs | |
132 | file system, the mount can fail if the special device | |
133 | specified in the ufs_args structure is | |
134 | inaccessible, is not an appropriate file, or is already mounted. | |
135 | A | |
136 | .I ufs | |
137 | mount can also fail if there are already too many | |
75f4d1ff KM |
138 | file systems mounted. |
139 | .PP | |
140 | .I Umount | |
156f4461 KM |
141 | returns 0 if the action occurred; \-1 if an error occurred. |
142 | The unmount will fail | |
143 | if there are active files in the mounted file system. | |
28e2febc KM |
144 | .SH ERRORS |
145 | .I Mount | |
146 | will fail when one of the following occurs: | |
147 | .TP 15 | |
156f4461 KM |
148 | [EPERM] |
149 | The caller is not the super-user. | |
150 | .TP 15 | |
b5984ffe | 151 | [ENAMETOOLONG] |
156f4461 KM |
152 | A component of a pathname exceeded 255 characters, |
153 | or the entire length of a path name exceeded 1023 characters. | |
b5984ffe KM |
154 | .TP 15 |
155 | [ELOOP] | |
156f4461 | 156 | Too many symbolic links were encountered in translating a pathname. |
28e2febc | 157 | .TP 15 |
b5984ffe | 158 | [ENOENT] |
156f4461 KM |
159 | A component of \fIdir\fP does not exist. |
160 | .TP 15 | |
161 | [ENOTDIR] | |
162 | A component of \fIname\fP is not a directory, | |
163 | or a path prefix of \fIspecial\fP is not a directory. | |
164 | .TP 15 | |
165 | [EINVAL] | |
166 | A pathname contains a character with the high-order bit set. | |
167 | .TP 15 | |
168 | [EBUSY] | |
169 | Another process currently holds a reference to | |
170 | .IR dir . | |
171 | .TP 15 | |
172 | [EFAULT] | |
173 | \fIDir\fP points outside the process's allocated address space. | |
174 | .PP | |
175 | The following errors can occur for a | |
176 | .I ufs | |
177 | file system mount: | |
b5984ffe KM |
178 | .TP 15 |
179 | [ENODEV] | |
156f4461 | 180 | A component of ufs_args \fIfspec\fP does not exist. |
28e2febc KM |
181 | .TP 15 |
182 | [ENOTBLK] | |
156f4461 | 183 | .I Fspec |
28e2febc KM |
184 | is not a block device. |
185 | .TP 15 | |
186 | [ENXIO] | |
187 | The major device number of | |
156f4461 | 188 | .I fspec |
28e2febc KM |
189 | is out of range (this indicates no device driver exists |
190 | for the associated hardware). | |
191 | .TP 15 | |
156f4461 KM |
192 | [EBUSY] |
193 | \fIFspec\fP is already mounted. | |
28e2febc | 194 | .TP 15 |
156f4461 KM |
195 | [EMFILE] |
196 | No space remains in the mount table. | |
28e2febc | 197 | .TP 15 |
b5984ffe | 198 | [EINVAL] |
28e2febc KM |
199 | The super block for the file system had a bad magic |
200 | number or an out of range block size. | |
201 | .TP 15 | |
b5984ffe | 202 | [ENOMEM] |
28e2febc KM |
203 | Not enough memory was available to read the cylinder |
204 | group information for the file system. | |
205 | .TP 15 | |
b5984ffe | 206 | [EIO] |
fd690c8b | 207 | An I/O error occurred while reading the super block or |
28e2febc | 208 | cylinder group information. |
fd690c8b KM |
209 | .TP 15 |
210 | [EFAULT] | |
156f4461 KM |
211 | \fIFspec\fP points outside the process's allocated address space. |
212 | .PP | |
213 | The following errors can occur for a | |
214 | .I nfs | |
215 | file system mount: | |
216 | .TP 15 | |
217 | [ETIMEDOUT] | |
218 | .I Nfs | |
219 | timed out trying to contact the server. | |
220 | .TP 15 | |
221 | [EFAULT] | |
222 | Some part of the information described by nfs_args | |
223 | points outside the process's allocated address space. | |
75f4d1ff | 224 | .PP |
28e2febc KM |
225 | .I Umount |
226 | may fail with one of the following errors: | |
227 | .TP 15 | |
156f4461 KM |
228 | [EPERM] |
229 | The caller is not the super-user. | |
230 | .TP 15 | |
b5984ffe | 231 | [ENOTDIR] |
156f4461 | 232 | A component of the path is not a directory. |
b5984ffe KM |
233 | .TP 15 |
234 | [EINVAL] | |
235 | The pathname contains a character with the high-order bit set. | |
236 | .TP 15 | |
237 | [ENAMETOOLONG] | |
238 | A component of a pathname exceeded 255 characters, | |
239 | or an entire path name exceeded 1023 characters. | |
240 | .TP 15 | |
241 | [ELOOP] | |
242 | Too many symbolic links were encountered in translating the pathname. | |
243 | .TP 15 | |
28e2febc | 244 | [EINVAL] |
156f4461 | 245 | The requested directory is not in the mount table. |
28e2febc KM |
246 | .TP 15 |
247 | [EBUSY] | |
248 | A process is holding a reference to a file located | |
249 | on the file system. | |
fd690c8b KM |
250 | .TP 15 |
251 | [EIO] | |
156f4461 | 252 | An I/O error occurred while writing cached file system information. |
fd690c8b KM |
253 | .TP 15 |
254 | [EFAULT] | |
156f4461 | 255 | \fIDir\fP points outside the process's allocated address space. |
28e2febc KM |
256 | .SH "SEE ALSO" |
257 | mount(8), umount(8) | |
258 | .SH BUGS | |
b5984ffe | 259 | Some of the error codes need translation to more obvious messages. |