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