]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/mount.2
clone.2: Rewrite crufty text about number of args in older version of clone()
[thirdparty/man-pages.git] / man2 / mount.2
CommitLineData
fea681da
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\"
3.\" Copyright (C) 1993 Rickard E. Faith <faith@cs.unc.edu>
6883b3e7 4.\" and Copyright (C) 1994 Andries E. Brouwer <aeb@cwi.nl>
c11b1abf 5.\" and Copyright (C) 2002, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da
MK
6.\"
7.\" Permission is granted to make and distribute verbatim copies of this
8.\" manual provided the copyright notice and this permission notice are
9.\" preserved on all copies.
10.\"
11.\" Permission is granted to copy and distribute modified versions of this
12.\" manual under the conditions for verbatim copying, provided that the
13.\" entire resulting derived work is distributed under the terms of a
14.\" permission notice identical to this one.
c13182ef 15.\"
fea681da
MK
16.\" Since the Linux kernel and libraries are constantly changing, this
17.\" manual page may be incorrect or out-of-date. The author(s) assume no
18.\" responsibility for errors or omissions, or for damages resulting from
19.\" the use of the information contained herein. The author(s) may not
20.\" have taken the same level of care in the production of this manual,
21.\" which is licensed free of charge, as they might when working
22.\" professionally.
c13182ef 23.\"
fea681da
MK
24.\" Formatted or processed versions of this manual, if unaccompanied by
25.\" the source, must acknowledge the copyright and authors of this work.
26.\"
27.\" Modified 1996-11-04 by Eric S. Raymond <esr@thyrsus.com>
c11b1abf 28.\" Modified 2001-10-13 by Michael Kerrisk <mtk.manpages@gmail.com>
d9bfdb9c 29.\" Added note on historical behavior of MS_NOSUID
c11b1abf 30.\" Modified 2002-05-16 by Michael Kerrisk <mtk.manpages@gmail.com>
fea681da
MK
31.\" Extensive changes and additions
32.\" Modified 2002-05-27 by aeb
c11b1abf 33.\" Modified 2002-06-11 by Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 34.\" Enhanced descriptions of MS_MOVE, MS_BIND, and MS_REMOUNT
c11b1abf 35.\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
8df37e4d 36.\" 2005-05-18, mtk, Added MNT_EXPIRE, plus a few other tidy-ups.
0a4d78bb
MK
37.\" 2008-10-06, mtk: move umount*() material into separate umount.2 page.
38.\" 2008-10-06, mtk: Add discussion of namespaces.
fea681da 39.\"
732e54dd 40.TH MOUNT 2 2008-11-20 "Linux" "Linux Programmer's Manual"
fea681da 41.SH NAME
5614f733 42mount \- mount file system
fea681da 43.SH SYNOPSIS
7998dde2 44.nf
fea681da
MK
45.B "#include <sys/mount.h>"
46.sp
47.BI "int mount(const char *" source ", const char *" target ,
7998dde2
MK
48.BI " const char *" filesystemtype ", unsigned long " mountflags ,
49.BI " const void *" data );
7998dde2 50.fi
fea681da 51.SH DESCRIPTION
e511ffb6 52.BR mount ()
24d01c53 53attaches the file system specified by
fea681da
MK
54.I source
55(which is often a device name, but can also be a directory name
56or a dummy) to the directory specified by
57.IR target .
58
fea681da
MK
59Appropriate privilege (Linux: the
60.B CAP_SYS_ADMIN
5614f733 61capability) is required to mount file systems.
fea681da 62
24d01c53 63Since Linux 2.4 a single file system can be visible at
fea681da
MK
64multiple mount points, and multiple mounts can be stacked
65on the same mount point.
66.\" Multiple mounts on same mount point: since 2.3.99pre7.
67
68Values for the
0daa9e92 69.I filesystemtype
fea681da
MK
70argument supported by the kernel are listed in
71.I /proc/filesystems
852ae8c8
MK
72(like "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs",
73"msdos", "proc", "nfs", "iso9660" etc.).
fea681da
MK
74Further types may become available when the appropriate modules
75are loaded.
76
77The
0daa9e92 78.I mountflags
fea681da
MK
79argument may have the magic number 0xC0ED (\fBMS_MGC_VAL\fP)
80in the top 16 bits (this was required in kernel versions prior to 2.4, but
81is no longer required and ignored if specified),
c84371c6
MK
82and various mount flags (as defined in \fI<linux/fs.h>\fP for libc4 and libc5
83and in \fI<sys/mount.h>\fP for glibc2) in the low order 16 bits:
cdab486d
MK
84.\" FIXME 2.6.15 added flags for "shared sub-tree" functionality:
85.\" MS_UNBINDABLE, MS_PRIVATE, MS_SHARED, MS_SLAVE
92057f4d 86.\" These need to be documented on this page.
3736a895
MK
87.\" See:
88.\" Documentation/filesystems/sharedsubtree.txt
b75101c3 89.\"
3736a895 90.\" http://lwn.net/Articles/159077/
b75101c3 91.\"
3736a895
MK
92.\" http://myweb.sudhaa.com:2022/~ram/sharedsubtree/paper/sharedsubtree.1.pdf
93.\" Shared-Subtree Concept, Implementation, and Applications in Linux
94.\" Al Viro viro@ftp.linux.org.uk
95.\" Ram Pai linuxram@us.ibm.com
b75101c3 96.\"
3736a895
MK
97.\" http://foss.in/2005/slides/sharedsubtree1.pdf
98.\" Shared Subtree Concept and Implementation in the Linux Kernel
99.\" Ram Pai
100.\"
fea681da 101.TP
599e5da7 102.BR MS_BIND " (Linux 2.4 onwards)"
fea681da
MK
103.\" since 2.4.0-test9
104Perform a bind mount, making a file or a directory subtree visible at
105another point within a file system.
106Bind mounts may cross file system boundaries and span
107.BR chroot (2)
108jails.
109The
33fc4771
MK
110.IR filesystemtype
111and
112.IR data
fea681da 113arguments are ignored.
33fc4771
MK
114Up until Linux 2.6.26,
115.I mountflags
116was also ignored
fea681da 117.\" with the exception of the "hidden" MS_REC mountflags bit