File: mount.2

package info (click to toggle)
manpages 1.29-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 4,796 kB
  • ctags: 5
  • sloc: sh: 79; makefile: 61
file content (163 lines) | stat: -rw-r--r-- 4,862 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (C) 1993 Rickard E. Faith <faith@cs.unc.edu>
.\" Copyright (C) 1994 Andries E. Brouwer <aeb@cwi.nl>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\" 
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\" 
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" "
.\" Modified Mon Nov  4 20:23:39 1996 by Eric S. Raymond <esr@thyrsus.com>
.TH MOUNT 2 "28 Nov 1994" "Linux 1.1.67" "Linux Programmer's Manual"
.SH NAME
mount, umount \- mount and unmount filesystems.
.SH SYNOPSIS
.B "#include <sys/mount.h>"
.sp
.BI "int mount(const char *" specialfile ", const char * " dir
.BI ", const char * " filesystemtype ", unsigned long " rwflag
.BI ", const void * " data );
.sp
.BI "int umount(const char *" specialfile );
.sp
.BI "int umount(const char *" dir );
.SH DESCRIPTION
.B mount
attaches the filesystem specified by
.I specialfile
(which is often a device name)
to the directory specified by
.IR dir .

.B umount
removes the attachment of the filesystem specified by
.IR specialfile
or
.IR dir .

Only the super-user may mount and unmount filesystems.

The
.IR filesystemtype
argument may take one of the values listed in /proc/filesystems
(like "minix", "ext2", "msdos", "proc", "nfs", "iso9660" etc.).

The
.IR rwflag
argument has the magic number 0xC0ED in the top 16 bits,
and various mount flags (as defined in <linux/fs.h> for libc4 and libc5
and in <sys/mount.h> for glibc2) in the low order 16 bits:
.nf
#define MS_RDONLY    1 /* mount read-only */
#define MS_NOSUID    2 /* ignore suid and sgid bits */
#define MS_NODEV     4 /* disallow access to device special files */
#define MS_NOEXEC    8 /* disallow program execution */
#define MS_SYNC     16 /* writes are synced at once */
#define MS_REMOUNT  32 /* alter flags of a mounted FS */
#define MS_MGC_VAL 0xC0ED0000
.fi
If the magic number is absent, then the last two arguments are not used.

The
.IR data
argument is interpreted by the different file systems.

.SH "RETURN VALUE"
On success, zero is returned.  On error, \-1 is returned, and
.I errno
is set appropriately.
.SH ERRORS
The error values given below result from filesystem type independent
errors. Each filesystem type may have its own special errors and its
own special behavior.  See the kernel source code for details.

.TP
.B EPERM
The user is not the super-user.
.TP
.B ENODEV
.I Filesystemtype
not configured in the kernel.
.TP
.B ENOTBLK
.I Specialfile
is not a block device (if a device was required).
.TP
.B EBUSY
.I Specialfile
is already mounted. Or, it cannot be remounted read-only,
because it still holds files open for writing.
Or, it cannot be mounted on
.I dir
because
.I dir
is still busy (it is the working directory of some task,
the mount point of another device, has open files, etc.).
.TP
.B EINVAL
.I Specialfile
had an invalid superblock.
Or, a remount was attempted, while
.I specialfile
was not already mounted on
.IR dir .
Or, an umount was attempted, while
.I dir
was not a mount point.
.TP
.B EFAULT
One of the pointer arguments points outside the user address space.
.TP
.B ENOMEM
The kernel could not allocate a free page to copy filenames or data into.
.TP
.B ENAMETOOLONG
A pathname was longer than MAXPATHLEN.
.TP
.B ENOENT
A pathname was empty or had a nonexistent component.
.TP
.B ENOTDIR
The second argument, or a prefix of the first argument, is not
a directory.
.TP
.B EACCES
A component of a path was not searchable.
.br
Or, mounting a read-only filesystem was attempted without giving the
MS_RDONLY flag.
.br
Or, the block device
.I Specialfile
is located on a filesystem mounted with the MS_NODEV option.
.TP
.B ENXIO
The major number of the block device
.I specialfile
is out of range.
.TP
.B EMFILE
(In case no block device is required:)
Table of dummy devices is full.
.SH "CONFORMING TO"
These functions are Linux-specific and should not be used in
programs intended to be portable.
.SH "SEE ALSO"
.BR mount (8),
.BR umount (8)