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