]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/mount.2
mount.2: ffix
[thirdparty/man-pages.git] / man2 / mount.2
CommitLineData
fea681da 1.\" Copyright (C) 1993 Rickard E. Faith <faith@cs.unc.edu>
6883b3e7 2.\" and Copyright (C) 1994 Andries E. Brouwer <aeb@cwi.nl>
eac1e050 3.\" and Copyright (C) 2002, 2005, 2016 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 4.\"
93015253 5.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
6.\" Permission is granted to make and distribute verbatim copies of this
7.\" manual provided the copyright notice and this permission notice are
8.\" preserved on all copies.
9.\"
10.\" Permission is granted to copy and distribute modified versions of this
11.\" manual under the conditions for verbatim copying, provided that the
12.\" entire resulting derived work is distributed under the terms of a
13.\" permission notice identical to this one.
c13182ef 14.\"
fea681da
MK
15.\" Since the Linux kernel and libraries are constantly changing, this
16.\" manual page may be incorrect or out-of-date. The author(s) assume no
17.\" responsibility for errors or omissions, or for damages resulting from
18.\" the use of the information contained herein. The author(s) may not
19.\" have taken the same level of care in the production of this manual,
20.\" which is licensed free of charge, as they might when working
21.\" professionally.
c13182ef 22.\"
fea681da
MK
23.\" Formatted or processed versions of this manual, if unaccompanied by
24.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 25.\" %%%LICENSE_END
fea681da
MK
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.\"
8538a62b 40.TH MOUNT 2 2018-02-02 "Linux" "Linux Programmer's Manual"
fea681da 41.SH NAME
9ee4a2b6 42mount \- mount filesystem
fea681da 43.SH SYNOPSIS
7998dde2 44.nf
fea681da 45.B "#include <sys/mount.h>"
68e4db0a 46.PP
fea681da 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 ()
9ee4a2b6 53attaches the filesystem specified by
fea681da 54.I source
751de899
MK
55(which is often a pathname referring to a device,
56but can also be the pathname of a directory or file,
57or a dummy string) to the location (a directory or file)
58specified by the pathname in
fea681da 59.IR target .
547ee319 60.PP
fea681da
MK
61Appropriate privilege (Linux: the
62.B CAP_SYS_ADMIN
9ee4a2b6 63capability) is required to mount filesystems.
547ee319 64.PP
fea681da 65Values for the
0daa9e92 66.I filesystemtype
fea681da
MK
67argument supported by the kernel are listed in
68.I /proc/filesystems
9792cd16
MK
69(e.g., "btrfs", "ext4", "jfs", "xfs", "vfat", "fuse",
70"tmpfs", "cgroup", "proc", "mqueue", "nfs", "cifs", "iso9660").
fea681da
MK
71Further types may become available when the appropriate modules
72are loaded.
547ee319 73.PP
b3ae9c7d
MK
74The
75.I data
76argument is interpreted by the different filesystems.
77Typically it is a string of comma-separated options
78understood by this filesystem.
79See
80.BR mount (8)
81for details of the options available for each filesystem type.
547ee319 82.PP
f429fadc
MK
83A call to
84.BR mount ()
c3a7b4e9 85performs one of a number of general types of operation,
f429fadc
MK
86depending on the bits specified in
87.IR mountflags .
c3a7b4e9
MK
88The choice of which operation to perform is determined by
89testing the bits set in
f429fadc
MK
90.IR mountflags ,
91with the tests being conducted in the order listed here:
92.IP * 3
93Remount an existing mount:
94.IR mountflags
95includes
96.BR MS_REMOUNT .
97.IP *
98Create a bind mount:
99.IR mountflags
100includes
101.BR MS_BIND .
102.IP *
103Change the propagation type of an existing mount:
104.IR mountflags
105includes one of
106.BR MS_SHARED ,
107.BR MS_PRIVATE ,
108.BR MS_SLAVE ,
109or
110.BR MS_UNBINDABLE .
111.IP *
112Move an existing mount to a new location:
113.IR mountflags
114includes
115.BR MS_MOVE .
116.IP *
117Create a new mount:
118.IR mountflags
119includes none of the above flags.
120.PP
121Each of these operations is detailed later in this page.
122Further flags may be specified in
123.IR mountflags
124to modify the behavior of
125.BR mount (),
126as described below.
2835e6c5 127.\"
f429fadc
MK
128.SS Additional mount flags
129The list below describes the additional flags that can be specified in
130.IR mountflags .
131Note that some operation types ignore some or all of these flags,
132as described later in this page.
2835e6c5 133.\"
bea08fec 134.\" FIXME 2.6.25 Added MS_I_VERSION, which needs to be documented.
21d995a8 135.\"
fea681da 136.TP
8df37e4d 137.BR MS_DIRSYNC " (since Linux 2.5.19)"
9ee4a2b6 138Make directory changes on this filesystem synchronous.
fea681da
MK
139(This property can be obtained for individual directories
140or subtrees using
49ec013c 141.BR chattr (1).)
fea681da 142.TP
9b249562 143.BR MS_LAZYTIME " (since Linux 4.0)"
42a8e396
MK
144.\" commit 0ae45f63d4ef8d8eeec49c7d8b44a1775fff13e8
145.\" commit fe032c422c5ba562ba9c2d316f55e258e03259c6
146.\" commit a26f49926da938f47561f386be56a83dd37a496d
147Reduce on-disk updates of inode timestamps (atime, mtime, ctime)
148by maintaining these changes only in memory.
149The on-disk timestamps are updated only when:
150.RS
151.IP (a) 5
152the inode needs to be updated for some change unrelated to file timestamps;
153.IP (b)
154the application employs
155.BR fsync (2),
156.BR syncfs (2),
157or
158.BR sync (2);
159.IP (c)
160an undeleted inode is evicted from memory; or
161.IP (d)
162more than 24 hours have passed since the inode was written to disk.
163.RE
164.IP
5eab76af 165This mount option significantly reduces writes
9cdabfa6
MK
166needed to update the inode's timestamps, especially mtime and atime.
167However, in the event of a system crash, the atime and mtime fields
168on disk might be out of date by up to 24 hours.
054ea65e 169.IP
9cdabfa6
MK
170Examples of workloads where this option could be of significant benefit
171include frequent random writes to preallocated files,
172as well as cases where the
173.B MS_STRICTATIME
174mount option is also enabled.
cdd14e51
MK
175(The advantage of combining
176.BR MS_STRICTATIME
177and
178.BR MS_LAZYTIME
9cdabfa6
MK
179is that
180.BR stat (2)
181will return the correctly updated atime, but the atime updates
5eab76af 182will be flushed to disk only in the cases listed above.)
42a8e396 183.TP
fea681da 184.B MS_MANDLOCK
9ee4a2b6 185Permit mandatory locking on files in this filesystem.
fea681da
MK
186(Mandatory locking must still be enabled on a per-file basis,
187as described in
188.BR fcntl (2).)
afa0b44d
MK
189Since Linux 4.5,
190.\" commit 95ace75414f312f9a7b93d873f386987b92a5301
191this mount option requires the
192.B CAP_SYS_ADMIN
193capability.
fea681da 194.TP
fea681da 195.B MS_NOATIME
9ee4a2b6 196Do not update access times for (all types of) files on this filesystem.
fea681da
MK
197.TP
198.B MS_NODEV
9ee4a2b6 199Do not allow access to devices (special files) on this filesystem.
fea681da
MK
200.TP
201.B MS_NODIRATIME
9ee4a2b6 202Do not update access times for directories on this filesystem.
882a9435
MK
203This flag provides a subset of the functionality provided by
204.BR MS_NOATIME ;
205that is,
206.BR MS_NOATIME
207implies
208.BR MS_NODIRATIME .
fea681da
MK
209.TP
210.B MS_NOEXEC
9ee4a2b6
MK
211Do not allow programs to be executed from this filesystem.
212.\" (Possibly useful for a filesystem that contains non-Linux executables.
75b94dc3 213.\" Often used as a security feature, e.g., to make sure that restricted
fea681da
MK
214.\" users cannot execute files uploaded using ftp or so.)
215.TP
216.B MS_NOSUID
4be9e801
MK
217Do not honor set-user-ID and set-group-ID bits or file capabilities
218when executing programs from this filesystem.
880f5b4b
MK
219.\" (This is a security feature to prevent users executing set-user-ID and
220.\" set-group-ID programs from removable disk devices.)
fea681da
MK
221.TP
222.B MS_RDONLY
9ee4a2b6 223Mount filesystem read-only.
eac1e050
MK
224.TP
225.BR MS_REC " (since Linux 2.4.11)"
226Used in conjunction with
227.BR MS_BIND
228to create a recursive bind mount,
229and in conjunction with the propagation type flags to recursively change
230the propagation type of all of the mounts in a subtree.
231See below for further details.
c13182ef 232.TP
31c1f2b0 233.BR MS_RELATIME " (since Linux 2.6.20)"
9ee4a2b6 234When a file on this filesystem is accessed,
33a0ccb2 235update the file's last access time (atime) only if the current value
7c40de08 236of atime is less than or equal to the file's last modification time (mtime)
926b6e37
MK
237or last status change time (ctime).
238This option is useful for programs, such as
239.BR mutt (1),
240that need to know when a file has been read since it was last modified.
02a4e226
MK
241Since Linux 2.6.30, the kernel defaults to the behavior provided
242by this flag (unless
243.BR MS_NOATIME
244was specified), and the
245.B MS_STRICTATIME
246flag is required to obtain traditional semantics.
247In addition, since Linux 2.6.30,
248the file's last access time is always updated if it
249is more than 1 day old.
250.\" Matthew Garrett notes in the patch that added this behavior
251.\" that this lets utilities such as tmpreaper (which deletes
5116355c 252.\" files based on last access time) work correctly.
fea681da 253.TP
f429fadc
MK
254.BR MS_SILENT " (since Linux 2.6.17)"
255Suppress the display of certain
256.RI ( printk ())
257warning messages in the kernel log.
258This flag supersedes the misnamed and obsolete
259.BR MS_VERBOSE
260flag (available since Linux 2.4.12), which has the same meaning.
261.TP
262.BR MS_STRICTATIME " (since Linux 2.6.30)"
263Always update the last access time (atime) when files on this
264filesystem are accessed.
265(This was the default behavior before Linux 2.6.30.)
266Specifying this flag overrides the effect of setting the
267.BR MS_NOATIME
268and
269.BR MS_RELATIME
270flags.
271.TP
272.B MS_SYNCHRONOUS
273Make writes on this filesystem synchronous (as though
274the
275.B O_SYNC
276flag to
277.BR open (2)
278was specified for all file opens to this filesystem).
279.PP
280From Linux 2.4 onward, the
281.BR MS_NODEV ", " MS_NOEXEC ", and " MS_NOSUID
282flags are settable on a per-mount-point basis.
283From kernel 2.6.16 onward,
284.B MS_NOATIME
285and
286.B MS_NODIRATIME
287are also settable on a per-mount-point basis.
288The
289.B MS_RELATIME
290flag is also settable on a per-mount-point basis.
c84a8779
N
291Since Linux 2.6.16,
292.B MS_RDONLY
293can be set or cleared on a per-mount-point basis as well as on
0e1a971b 294the underlying filesystem.
9edbd686
MK
295The mounted filesystem will be writable only if neither the filesystem
296nor the mountpoint are flagged as read-only.
f429fadc
MK
297.\"
298.SS Remounting an existing mount
299An existing mount may be remounted by specifying
fea681da 300.B MS_REMOUNT
f429fadc
MK
301in
302.IR mountflags .
599e5da7 303This allows you to change the
fea681da
MK
304.I mountflags
305and
306.I data
9ee4a2b6 307of an existing mount without having to unmount and remount the filesystem.
fea681da 308.I target
44535dd2 309should be the same value specified in the initial
fea681da 310.BR mount ()
74b46b5f 311call.
547ee319 312.PP
74b46b5f 313The
44535dd2
MK
314.I source
315and
fea681da 316.I filesystemtype
74b46b5f 317arguments are ignored.
547ee319 318.PP
69b6b231
EB
319The
320.I mountflags
321and
322.I data
323arguments should match the values used in the original
324.BR mount ()
325call, except for those parameters that are being deliberately changed.
c84a8779
N
326Another exception is that
327.B MS_BIND
a4222367 328has a different meaning for remount, and it should be included only if
c84a8779 329explicitly desired.
a4222367 330.PP
178b977b 331The following
c13182ef 332.I mountflags
178b977b 333can be changed:
9c2678e6 334.BR MS_LAZYTIME ,
014b17c6
MK
335.BR MS_MANDLOCK ,
336.BR MS_NOATIME ,
178b977b 337.BR MS_NODEV ,
014b17c6
MK
338.BR MS_NODIRATIME ,
339.BR MS_NOEXEC ,
340.BR MS_NOSUID ,
9c2678e6 341.BR MS_RELATIME ,
014b17c6 342.BR MS_RDONLY ,
16008a41 343and
014b17c6 344.BR MS_SYNCHRONOUS .
d8b67bc9
MK
345Attempts to change the setting of the
346.\" See the definition of MS_RMT_MASK in include/uapi/linux/fs.h
347.BR MS_DIRSYNC
348flag during a remount are silently ignored.
547ee319 349.PP
49f68546
MK
350Since Linux 3.17,
351.\" commit ffbc6f0ead47fa5a1dc9642b0331cb75c20a640e
352if none of
353.BR MS_NOATIME ,
354.BR MS_NODIRATIME ,
355.BR MS_RELATIME ,
356or
357.BR MS_STRICTATIME
358is specified in
359.IR mountflags ,
360then the remount operation preserves the existing values of these flags
361(rather than defaulting to
362.BR MS_RELATIME ).
a4222367 363.PP
5ea1abf8
MK
364Since Linux 2.6.26, the
365.B MS_RMOUNT
366flag can be used with
c84a8779 367.B MS_BIND
a4222367 368to modify only the per-mount-point flags.
f5da58a8 369.\" See https://lwn.net/Articles/281157/
c84a8779
N
370This is particularly useful for setting or clearing the "read-only"
371flag on a mount point without changing the underlying filesystem.
372Specifying
f5da58a8
MK
373.IR mountflags
374as:
a4222367 375.PP
e56ab30d
MK
376.in +4n
377.EX
378MS_REMOUNT | MS_BIND | MS_RDONLY
379.EE
380.in
a4222367 381.PP
c84a8779
N
382will make access through this mountpoint read-only, without affecting
383other mount points.
f429fadc
MK
384.\"
385.SS Creating a bind mount
386If
387.I mountflags
388includes
389.BR MS_BIND
390(available since Linux 2.4),
391.\" since 2.4.0-test9
392then perform a bind mount.
393A bind mount makes a file or a directory subtree visible at
394another point within the single directory hierarchy.
395Bind mounts may cross filesystem boundaries and span
396.BR chroot (2)
397jails.
547ee319 398.PP
f429fadc
MK
399The
400.IR filesystemtype
02a4e226 401and
f429fadc
MK
402.IR data
403arguments are ignored.
547ee319 404.PP
f429fadc
MK
405The remaining bits in the
406.I mountflags
407argument are also ignored, with the exception of
408.BR MS_REC .
409(The bind mount has the same mount options as
410the underlying mount point.)
411However, see the discussion of remounting above,
412for a method of making an existing bind mount read-only.
547ee319 413.PP
eac1e050
MK
414By default, when a directory is bind mounted,
415only that directory is mounted;
416if there are any submounts under the directory tree,
417they are not bind mounted.
418If the
419.BR MS_REC
420flag is also specified, then a recursive bind mount operation is performed:
421all submounts under the
422.I source
423subtree (other than unbindable mounts)
424are also bind mounted at the corresponding location in the
425.I target
426subtree.
f429fadc
MK
427.\"
428.SS Changing the propagation type of an existing mount
c8e5f558
MK
429If
430.IR mountflags
431includes one of
432.BR MS_SHARED ,
433.BR MS_PRIVATE ,
434.BR MS_SLAVE ,
435or
436.BR MS_UNBINDABLE
437(all available since Linux 2.6.15),
438then the propagation type of an existing mount is changed.
439If more than one of these flags is specified, an error results.
547ee319 440.PP
c8e5f558
MK
441The only flags that can be used with changing the propagation type are
442.BR MS_REC
443and
444.BR MS_SILENT .
547ee319 445.PP
c8e5f558
MK
446The
447.IR source ,
448.IR filesystemtype ,
449and
450.IR data
451arguments are ignored.
547ee319 452.PP
c8e5f558
MK
453The meanings of the propagation type flags are as follows:
454.TP
455.BR MS_SHARED
456Make this mount point shared.
457Mount and unmount events immediately under this mount point will propagate
458to the other mount points that are members of this mount's peer group.
459Propagation here means that the same mount or unmount will automatically
460occur under all of the other mount points in the peer group.
461Conversely, mount and unmount events that take place under
462peer mount points will propagate to this mount point.
463.TP
464.BR MS_PRIVATE
465Make this mount point private.
466Mount and unmount events do not propagate into or out of this mount point.
c8e5f558
MK
467.TP
468.BR MS_SLAVE
469If this is a shared mount point that is a member of a peer group
470that contains other members, convert it to a slave mount.
471If this is a shared mount point that is a member of a peer group
472that contains no other members, convert it to a private mount.
473Otherwise, the propagation type of the mount point is left unchanged.
054ea65e 474.IP
c8e5f558
MK
475When a mount point is a slave,
476mount and unmount events propagate into this mount point from
477the (master) shared peer group of which it was formerly a member.
478Mount and unmount events under this mount point do not propagate to any peer.
054ea65e 479.IP
c8e5f558
MK
480A mount point can be the slave of another peer group
481while at the same time sharing mount and unmount events
482with a peer group of which it is a member.
483.TP
484.BR MS_UNBINDABLE
485Make this mount unbindable.
486This is like a private mount,
487and in addition this mount can't be bind mounted.
488When a recursive bind mount
bf7bc8b8 489.RB ( mount ()
c8e5f558
MK
490with the
491.BR MS_BIND
492and
493.BR MS_REC
494flags) is performed on a directory subtree,
495any bind mounts within the subtree are automatically pruned
496(i.e., not replicated)
497when replicating that subtree to produce the target subtree.
eac1e050
MK
498.PP
499By default, changing the propagation type affects only the
500.I target
501mount point.
502If the
503.B MS_REC
504flag is also specified in
505.IR mountflags ,
506then the propagation type of all mount points under
507.IR target
508is also changed.
547ee319 509.PP
472bbe3b
MK
510For further details regarding mount propagation types
511(including the default propagation type assigned to new mounts), see
b7b79845 512.BR mount_namespaces (7).
f429fadc
MK
513.\"
514.SS Moving a mount
515If
516.I mountflags
517contains the flag
4a19136b
MK
518.BR MS_MOVE
519(available since Linux 2.4.18),
f429fadc
MK
520then move a subtree:
521.I source
522specifies an existing mount point and
523.I target
524specifies the new location to which that mount point is to be relocated.
525The move is atomic: at no point is the subtree unmounted.
547ee319 526.PP
f429fadc
MK
527The remaining bits in the
528.IR mountflags
529argument are ignored, as are the
530.IR filesystemtype
564d9941 531and
f429fadc
MK
532.IR data
533arguments.
534.\"
535.SS Creating a new mount point
536If none of
537.BR MS_REMOUNT ,
538.BR MS_BIND ,
539.BR MS_MOVE ,
540.BR MS_SHARED ,
541.BR MS_PRIVATE ,
542.BR MS_SLAVE ,
543or
544.BR MS_UNBINDABLE
545is specified in
546.IR mountflags ,
547then
548.BR mount ()
549performs its default action: creating a new mount point.
550.IR source
551specifies the source for the new mount point, and
552.IR target
553specifies the directory at which to create the mount point.
547ee319 554.PP
c13182ef 555The
f429fadc
MK
556.I filesystemtype
557and
558.I data
559arguments are employed, and further bits may be specified in
560.IR mountflags
561to modify the behavior of the call.
562.\"
d282bb24 563.SH RETURN VALUE
c13182ef
MK
564On success, zero is returned.
565On error, \-1 is returned, and
fea681da
MK
566.I errno
567is set appropriately.
568.SH ERRORS
569The error values given below result from filesystem type independent
c13182ef 570errors.
9ee4a2b6 571Each filesystem type may have its own special errors and its
c13182ef 572own special behavior.
66a9882e 573See the Linux kernel source code for details.
fea681da
MK
574.TP
575.B EACCES
c13182ef
MK
576A component of a path was not searchable.
577(See also
ad7cc990 578.BR path_resolution (7).)
9e1ae4f8
MK
579.TP
580.B EACCES
581Mounting a read-only filesystem was attempted without giving the
c13182ef 582.B MS_RDONLY
8df37e4d 583flag.
9e1ae4f8
MK
584.TP
585.B EACCES
586The block device
fea681da 587.I source
9ee4a2b6 588is located on a filesystem mounted with the
8df37e4d
MK
589.B MS_NODEV
590option.
fea681da
MK
591.\" mtk: Probably: write permission is required for MS_BIND, with
592.\" the error EPERM if not present; CAP_DAC_OVERRIDE is required.
593.TP
594.B EBUSY
050f3494
MK
595An attempt was made to stack a new mount directly on
596top of an existing mount point that was created in this
597mount namespace with the same
598.I source
599and
600.IR target .
601.TP
602.B EBUSY
9e1ae4f8
MK
603.I source
604cannot be remounted read-only,
fea681da 605because it still holds files open for writing.
9e1ae4f8 606.TP
fea681da
MK
607.B EFAULT
608One of the pointer arguments points outside the user address space.
609.TP
610.B EINVAL
611.I source
612had an invalid superblock.
9e1ae4f8
MK
613.TP
614.B EINVAL
615A remount operation
8df37e4d
MK
616.RB ( MS_REMOUNT )
617was attempted, but
fea681da
MK
618.I source
619was not already mounted on
620.IR target .
9e1ae4f8
MK
621.TP
622.B EINVAL
623A move operation
8df37e4d
MK
624.RB ( MS_MOVE )
625was attempted, but
fea681da 626.I source
f81fb444 627was not a mount point, or was \(aq/\(aq.
fea681da 628.TP
c8e5f558
MK
629.B EINVAL
630.I mountflags
631includes more than one of
632.BR MS_SHARED ,
633.BR MS_PRIVATE ,
634.BR MS_SLAVE ,
635or
636.BR MS_UNBINDABLE .
637.TP
638.B EINVAL
639.I mountflags
640includes
641.BR MS_SHARED ,
642.BR MS_PRIVATE ,
643.BR MS_SLAVE ,
644or
645.BR MS_UNBINDABLE
646and also includes a flag other than
647.BR MS_REC
648or
649.BR MS_SILENT .
650.TP
651.BR EINVAL
652An attempt was made to bind mount an unbindable mount.
653.TP
360d7455 654.BR EINVAL
f54c67bf
MK
655In an unprivileged mount namespace
656(i.e., a mount namespace owned by a user namespace
657that was created by an unprivileged user),
658a bind mount operation
360d7455
KF
659.RB ( MS_BIND )
660was attempted without specifying
661.RB ( MS_REC ),
3484e69f 662which would have revealed the filesystem tree underneath one of
360d7455
KF
663the submounts of the directory being bound.
664.TP
fea681da 665.B ELOOP
9b9b4a81 666Too many links encountered during pathname resolution.
9e1ae4f8
MK
667.TP
668.B ELOOP
669A move operation was attempted, and
fea681da
MK
670.I target
671is a descendant of
672.IR source .
673.TP
674.B EMFILE
675(In case no block device is required:)
676Table of dummy devices is full.
677.TP
678.B ENAMETOOLONG
682edefb
MK
679A pathname was longer than
680.BR MAXPATHLEN .
fea681da
MK
681.TP
682.B ENODEV
a90440ba 683.I filesystemtype
fea681da
MK
684not configured in the kernel.
685.TP
686.B ENOENT
687A pathname was empty or had a nonexistent component.
688.TP
689.B ENOMEM
690The kernel could not allocate a free page to copy filenames or data into.
691.TP
692.B ENOTBLK
693.I source
694is not a block device (and a device was required).
695.TP
696.B ENOTDIR
5614f733
MK
697.IR target ,
698or a prefix of
699.IR source ,
700is not a directory.
fea681da
MK
701.TP
702.B ENXIO
703The major number of the block device
704.I source
705is out of range.
706.TP
707.B EPERM
708The caller does not have the required privileges.
9326e678
MK
709.SH VERSIONS
710The definitions of
711.BR MS_DIRSYNC ,
712.BR MS_MOVE ,
f429fadc 713.BR MS_PRIVATE ,
9326e678
MK
714.BR MS_REC ,
715.BR MS_RELATIME ,
f429fadc 716.BR MS_SHARED ,
67215694 717.BR MS_SLAVE ,
9326e678 718.BR MS_STRICTATIME
f429fadc
MK
719and
720.BR MS_UNBINDABLE
33a0ccb2 721were added to glibc headers in version 2.12.
f429fadc 722.\"
d282bb24 723.SH CONFORMING TO
5614f733 724This function is Linux-specific and should not be used in
fea681da 725programs intended to be portable.
889829be 726.SH NOTES
f54e02b4
MK
727Since Linux 2.4 a single filesystem can be mounted at
728multiple mount points, and multiple mounts can be stacked
729on the same mount point.
730.\" Multiple mounts on same mount point: since 2.3.99pre7.
547ee319 731.PP
52f00c05
MK
732The
733.I mountflags
734argument may have the magic number 0xC0ED (\fBMS_MGC_VAL\fP)
735in the top 16 bits.
736(All of the other flags discussed in DESCRIPTION
737occupy the low order 16 bits of
738.IR mountflags .)
739Specifying
740.BR MS_MGC_VAL
741was required in kernel versions prior to 2.4,
742but since Linux 2.4 is no longer required and is ignored if specified.
547ee319 743.PP
fea681da 744The original
0daa9e92 745.B MS_SYNC
682edefb 746flag was renamed
0daa9e92 747.B MS_SYNCHRONOUS
682edefb
MK
748in 1.1.69
749when a different
0daa9e92 750.B MS_SYNC
682edefb 751was added to \fI<mman.h>\fP.
dd3568a1 752.PP
880f5b4b 753Before Linux 2.4 an attempt to execute a set-user-ID or set-group-ID program
9ee4a2b6 754on a filesystem mounted with
fea681da
MK
755.B MS_NOSUID
756would fail with
757.BR EPERM .
c13182ef 758Since Linux 2.4 the set-user-ID and set-group-ID bits are
880f5b4b 759just silently ignored in this case.
fea681da 760.\" The change is in patch-2.4.0-prerelease.
f54e02b4 761.\"
29a68c5b 762.SS Per-process namespaces
4df2eb09 763Starting with kernel 2.4.19, Linux provides
732e54dd 764per-process mount namespaces.
9ee4a2b6 765A mount namespace is the set of filesystem mounts that
4df2eb09
MK
766are visible to a process.
767Mount-point namespaces can be (and usually are)
768shared between multiple processes,
0a4d78bb
MK
769and changes to the namespace (i.e., mounts and unmounts) by one process
770are visible to all other processes sharing the same namespace.