]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/mount.2
rename.2: Add feature test macro for renameat2()
[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.
547ee319 169.PP
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
c84a8779
N
364Since Linux 2.6.26, this flag can be used with
365.B MS_BIND
a4222367 366to modify only the per-mount-point flags.
f5da58a8 367.\" See https://lwn.net/Articles/281157/
c84a8779
N
368This is particularly useful for setting or clearing the "read-only"
369flag on a mount point without changing the underlying filesystem.
370Specifying
f5da58a8
MK
371.IR mountflags
372as:
a4222367 373.PP
f5da58a8 374 MS_REMOUNT | MS_BIND | MS_RDONLY
a4222367 375.PP
c84a8779
N
376will make access through this mountpoint read-only, without affecting
377other mount points.
f429fadc
MK
378.\"
379.SS Creating a bind mount
380If
381.I mountflags
382includes
383.BR MS_BIND
384(available since Linux 2.4),
385.\" since 2.4.0-test9
386then perform a bind mount.
387A bind mount makes a file or a directory subtree visible at
388another point within the single directory hierarchy.
389Bind mounts may cross filesystem boundaries and span
390.BR chroot (2)
391jails.
547ee319 392.PP
f429fadc
MK
393The
394.IR filesystemtype
02a4e226 395and
f429fadc
MK
396.IR data
397arguments are ignored.
547ee319 398.PP
f429fadc
MK
399The remaining bits in the
400.I mountflags
401argument are also ignored, with the exception of
402.BR MS_REC .
403(The bind mount has the same mount options as
404the underlying mount point.)
405However, see the discussion of remounting above,
406for a method of making an existing bind mount read-only.
547ee319 407.PP
eac1e050
MK
408By default, when a directory is bind mounted,
409only that directory is mounted;
410if there are any submounts under the directory tree,
411they are not bind mounted.
412If the
413.BR MS_REC
414flag is also specified, then a recursive bind mount operation is performed:
415all submounts under the
416.I source
417subtree (other than unbindable mounts)
418are also bind mounted at the corresponding location in the
419.I target
420subtree.
f429fadc
MK
421.\"
422.SS Changing the propagation type of an existing mount
c8e5f558
MK
423If
424.IR mountflags
425includes one of
426.BR MS_SHARED ,
427.BR MS_PRIVATE ,
428.BR MS_SLAVE ,
429or
430.BR MS_UNBINDABLE
431(all available since Linux 2.6.15),
432then the propagation type of an existing mount is changed.
433If more than one of these flags is specified, an error results.
547ee319 434.PP
c8e5f558
MK
435The only flags that can be used with changing the propagation type are
436.BR MS_REC
437and
438.BR MS_SILENT .
547ee319 439.PP
c8e5f558
MK
440The
441.IR source ,
442.IR filesystemtype ,
443and
444.IR data
445arguments are ignored.
547ee319 446.PP
c8e5f558
MK
447The meanings of the propagation type flags are as follows:
448.TP
449.BR MS_SHARED
450Make this mount point shared.
451Mount and unmount events immediately under this mount point will propagate
452to the other mount points that are members of this mount's peer group.
453Propagation here means that the same mount or unmount will automatically
454occur under all of the other mount points in the peer group.
455Conversely, mount and unmount events that take place under
456peer mount points will propagate to this mount point.
457.TP
458.BR MS_PRIVATE
459Make this mount point private.
460Mount and unmount events do not propagate into or out of this mount point.
c8e5f558
MK
461.TP
462.BR MS_SLAVE
463If this is a shared mount point that is a member of a peer group
464that contains other members, convert it to a slave mount.
465If this is a shared mount point that is a member of a peer group
466that contains no other members, convert it to a private mount.
467Otherwise, the propagation type of the mount point is left unchanged.
547ee319 468.PP
c8e5f558
MK
469When a mount point is a slave,
470mount and unmount events propagate into this mount point from
471the (master) shared peer group of which it was formerly a member.
472Mount and unmount events under this mount point do not propagate to any peer.
547ee319 473.PP
c8e5f558
MK
474A mount point can be the slave of another peer group
475while at the same time sharing mount and unmount events
476with a peer group of which it is a member.
477.TP
478.BR MS_UNBINDABLE
479Make this mount unbindable.
480This is like a private mount,
481and in addition this mount can't be bind mounted.
482When a recursive bind mount
bf7bc8b8 483.RB ( mount ()
c8e5f558
MK
484with the
485.BR MS_BIND
486and
487.BR MS_REC
488flags) is performed on a directory subtree,
489any bind mounts within the subtree are automatically pruned
490(i.e., not replicated)
491when replicating that subtree to produce the target subtree.
eac1e050
MK
492.PP
493By default, changing the propagation type affects only the
494.I target
495mount point.
496If the
497.B MS_REC
498flag is also specified in
499.IR mountflags ,
500then the propagation type of all mount points under
501.IR target
502is also changed.
547ee319 503.PP
472bbe3b
MK
504For further details regarding mount propagation types
505(including the default propagation type assigned to new mounts), see
b7b79845 506.BR mount_namespaces (7).
f429fadc
MK
507.\"
508.SS Moving a mount
509If
510.I mountflags
511contains the flag
4a19136b
MK
512.BR MS_MOVE
513(available since Linux 2.4.18),
f429fadc
MK
514then move a subtree:
515.I source
516specifies an existing mount point and
517.I target
518specifies the new location to which that mount point is to be relocated.
519The move is atomic: at no point is the subtree unmounted.
547ee319 520.PP
f429fadc
MK
521The remaining bits in the
522.IR mountflags
523argument are ignored, as are the
524.IR filesystemtype
564d9941 525and
f429fadc
MK
526.IR data
527arguments.
528.\"
529.SS Creating a new mount point
530If none of
531.BR MS_REMOUNT ,
532.BR MS_BIND ,
533.BR MS_MOVE ,
534.BR MS_SHARED ,
535.BR MS_PRIVATE ,
536.BR MS_SLAVE ,
537or
538.BR MS_UNBINDABLE
539is specified in
540.IR mountflags ,
541then
542.BR mount ()
543performs its default action: creating a new mount point.
544.IR source
545specifies the source for the new mount point, and
546.IR target
547specifies the directory at which to create the mount point.
547ee319 548.PP
c13182ef 549The
f429fadc
MK
550.I filesystemtype
551and
552.I data
553arguments are employed, and further bits may be specified in
554.IR mountflags
555to modify the behavior of the call.
556.\"
d282bb24 557.SH RETURN VALUE
c13182ef
MK
558On success, zero is returned.
559On error, \-1 is returned, and
fea681da
MK
560.I errno
561is set appropriately.
562.SH ERRORS
563The error values given below result from filesystem type independent
c13182ef 564errors.
9ee4a2b6 565Each filesystem type may have its own special errors and its
c13182ef 566own special behavior.
66a9882e 567See the Linux kernel source code for details.
fea681da
MK
568.TP
569.B EACCES
c13182ef
MK
570A component of a path was not searchable.
571(See also
ad7cc990 572.BR path_resolution (7).)
9e1ae4f8
MK
573.TP
574.B EACCES
575Mounting a read-only filesystem was attempted without giving the
c13182ef 576.B MS_RDONLY
8df37e4d 577flag.
9e1ae4f8
MK
578.TP
579.B EACCES
580The block device
fea681da 581.I source
9ee4a2b6 582is located on a filesystem mounted with the
8df37e4d
MK
583.B MS_NODEV
584option.
fea681da
MK
585.\" mtk: Probably: write permission is required for MS_BIND, with
586.\" the error EPERM if not present; CAP_DAC_OVERRIDE is required.
587.TP
588.B EBUSY
050f3494
MK
589An attempt was made to stack a new mount directly on
590top of an existing mount point that was created in this
591mount namespace with the same
592.I source
593and
594.IR target .
595.TP
596.B EBUSY
9e1ae4f8
MK
597.I source
598cannot be remounted read-only,
fea681da 599because it still holds files open for writing.
9e1ae4f8 600.TP
fea681da
MK
601.B EFAULT
602One of the pointer arguments points outside the user address space.
603.TP
604.B EINVAL
605.I source
606had an invalid superblock.
9e1ae4f8
MK
607.TP
608.B EINVAL
609A remount operation
8df37e4d
MK
610.RB ( MS_REMOUNT )
611was attempted, but
fea681da
MK
612.I source
613was not already mounted on
614.IR target .
9e1ae4f8
MK
615.TP
616.B EINVAL
617A move operation
8df37e4d
MK
618.RB ( MS_MOVE )
619was attempted, but
fea681da 620.I source
f81fb444 621was not a mount point, or was \(aq/\(aq.
fea681da 622.TP
c8e5f558
MK
623.B EINVAL
624.I mountflags
625includes more than one of
626.BR MS_SHARED ,
627.BR MS_PRIVATE ,
628.BR MS_SLAVE ,
629or
630.BR MS_UNBINDABLE .
631.TP
632.B EINVAL
633.I mountflags
634includes
635.BR MS_SHARED ,
636.BR MS_PRIVATE ,
637.BR MS_SLAVE ,
638or
639.BR MS_UNBINDABLE
640and also includes a flag other than
641.BR MS_REC
642or
643.BR MS_SILENT .
644.TP
645.BR EINVAL
646An attempt was made to bind mount an unbindable mount.
647.TP
360d7455 648.BR EINVAL
f54c67bf
MK
649In an unprivileged mount namespace
650(i.e., a mount namespace owned by a user namespace
651that was created by an unprivileged user),
652a bind mount operation
360d7455
KF
653.RB ( MS_BIND )
654was attempted without specifying
655.RB ( MS_REC ),
3484e69f 656which would have revealed the filesystem tree underneath one of
360d7455
KF
657the submounts of the directory being bound.
658.TP
fea681da 659.B ELOOP
9b9b4a81 660Too many links encountered during pathname resolution.
9e1ae4f8
MK
661.TP
662.B ELOOP
663A move operation was attempted, and
fea681da
MK
664.I target
665is a descendant of
666.IR source .
667.TP
668.B EMFILE
669(In case no block device is required:)
670Table of dummy devices is full.
671.TP
672.B ENAMETOOLONG
682edefb
MK
673A pathname was longer than
674.BR MAXPATHLEN .
fea681da
MK
675.TP
676.B ENODEV
a90440ba 677.I filesystemtype
fea681da
MK
678not configured in the kernel.
679.TP
680.B ENOENT
681A pathname was empty or had a nonexistent component.
682.TP
683.B ENOMEM
684The kernel could not allocate a free page to copy filenames or data into.
685.TP
686.B ENOTBLK
687.I source
688is not a block device (and a device was required).
689.TP
690.B ENOTDIR
5614f733
MK
691.IR target ,
692or a prefix of
693.IR source ,
694is not a directory.
fea681da
MK
695.TP
696.B ENXIO
697The major number of the block device
698.I source
699is out of range.
700.TP
701.B EPERM
702The caller does not have the required privileges.
9326e678
MK
703.SH VERSIONS
704The definitions of
705.BR MS_DIRSYNC ,
706.BR MS_MOVE ,
f429fadc 707.BR MS_PRIVATE ,
9326e678
MK
708.BR MS_REC ,
709.BR MS_RELATIME ,
f429fadc 710.BR MS_SHARED ,
67215694 711.BR MS_SLAVE ,
9326e678 712.BR MS_STRICTATIME
f429fadc
MK
713and
714.BR MS_UNBINDABLE
33a0ccb2 715were added to glibc headers in version 2.12.
f429fadc 716.\"
d282bb24 717.SH CONFORMING TO
5614f733 718This function is Linux-specific and should not be used in
fea681da 719programs intended to be portable.
889829be 720.SH NOTES
f54e02b4
MK
721Since Linux 2.4 a single filesystem can be mounted at
722multiple mount points, and multiple mounts can be stacked
723on the same mount point.
724.\" Multiple mounts on same mount point: since 2.3.99pre7.
547ee319 725.PP
52f00c05
MK
726The
727.I mountflags
728argument may have the magic number 0xC0ED (\fBMS_MGC_VAL\fP)
729in the top 16 bits.
730(All of the other flags discussed in DESCRIPTION
731occupy the low order 16 bits of
732.IR mountflags .)
733Specifying
734.BR MS_MGC_VAL
735was required in kernel versions prior to 2.4,
736but since Linux 2.4 is no longer required and is ignored if specified.
547ee319 737.PP
fea681da 738The original
0daa9e92 739.B MS_SYNC
682edefb 740flag was renamed
0daa9e92 741.B MS_SYNCHRONOUS
682edefb
MK
742in 1.1.69
743when a different
0daa9e92 744.B MS_SYNC
682edefb 745was added to \fI<mman.h>\fP.
dd3568a1 746.PP
880f5b4b 747Before Linux 2.4 an attempt to execute a set-user-ID or set-group-ID program
9ee4a2b6 748on a filesystem mounted with
fea681da
MK
749.B MS_NOSUID
750would fail with
751.BR EPERM .
c13182ef 752Since Linux 2.4 the set-user-ID and set-group-ID bits are
880f5b4b 753just silently ignored in this case.
fea681da 754.\" The change is in patch-2.4.0-prerelease.
f54e02b4 755.\"
29a68c5b 756.SS Per-process namespaces
4df2eb09 757Starting with kernel 2.4.19, Linux provides
732e54dd 758per-process mount namespaces.
9ee4a2b6 759A mount namespace is the set of filesystem mounts that
4df2eb09
MK
760are visible to a process.
761Mount-point namespaces can be (and usually are)
762shared between multiple processes,
0a4d78bb
MK
763and changes to the namespace (i.e., mounts and unmounts) by one process
764are visible to all other processes sharing the same namespace.