]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/mount.2
mount.2: srcfix: Remove obsolete FIXME
[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-07-17 "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 .\"
292 .SS Remounting an existing mount
293 An existing mount may be remounted by specifying
294 .B MS_REMOUNT
295 in
296 .IR mountflags .
297 This allows you to change the
298 .I mountflags
299 and
300 .I data
301 of an existing mount without having to unmount and remount the filesystem.
302 .I target
303 should be the same value specified in the initial
304 .BR mount ()
305 call.
306
307 The
308 .I source
309 and
310 .I filesystemtype
311 arguments are ignored.
312
313 The
314 .I mountflags
315 and
316 .I data
317 arguments should match the values used in the original
318 .BR mount ()
319 call, except for those parameters that are being deliberately changed.
320
321 The following
322 .I mountflags
323 can be changed:
324 .BR MS_LAZYTIME ,
325 .BR MS_MANDLOCK ,
326 .BR MS_NOATIME ,
327 .BR MS_NODEV ,
328 .BR MS_NODIRATIME ,
329 .BR MS_NOEXEC ,
330 .BR MS_NOSUID ,
331 .BR MS_RELATIME ,
332 .BR MS_RDONLY ,
333 and
334 .BR MS_SYNCHRONOUS .
335 Attempts to change the setting of the
336 .\" See the definition of MS_RMT_MASK in include/uapi/linux/fs.h
337 .BR MS_DIRSYNC
338 flag during a remount are silently ignored.
339
340 Since Linux 3.17,
341 .\" commit ffbc6f0ead47fa5a1dc9642b0331cb75c20a640e
342 if none of
343 .BR MS_NOATIME ,
344 .BR MS_NODIRATIME ,
345 .BR MS_RELATIME ,
346 or
347 .BR MS_STRICTATIME
348 is specified in
349 .IR mountflags ,
350 then the remount operation preserves the existing values of these flags
351 (rather than defaulting to
352 .BR MS_RELATIME ).
353
354 Since Linux 2.6.26, this flag can also be used to make
355 .\" See https://lwn.net/Articles/281157/
356 an existing bind mount read-only by specifying
357 .IR mountflags
358 as:
359
360 MS_REMOUNT | MS_BIND | MS_RDONLY
361
362 Note that only the
363 .BR MS_RDONLY
364 setting of the bind mount can be changed in this manner.
365 .\"
366 .SS Creating a bind mount
367 If
368 .I mountflags
369 includes
370 .BR MS_BIND
371 (available since Linux 2.4),
372 .\" since 2.4.0-test9
373 then perform a bind mount.
374 A bind mount makes a file or a directory subtree visible at
375 another point within the single directory hierarchy.
376 Bind mounts may cross filesystem boundaries and span
377 .BR chroot (2)
378 jails.
379
380 The
381 .IR filesystemtype
382 and
383 .IR data
384 arguments are ignored.
385
386 The remaining bits in the
387 .I mountflags
388 argument are also ignored, with the exception of
389 .BR MS_REC .
390 (The bind mount has the same mount options as
391 the underlying mount point.)
392 However, see the discussion of remounting above,
393 for a method of making an existing bind mount read-only.
394
395 By default, when a directory is bind mounted,
396 only that directory is mounted;
397 if there are any submounts under the directory tree,
398 they are not bind mounted.
399 If the
400 .BR MS_REC
401 flag is also specified, then a recursive bind mount operation is performed:
402 all submounts under the
403 .I source
404 subtree (other than unbindable mounts)
405 are also bind mounted at the corresponding location in the
406 .I target
407 subtree.
408 .\"
409 .SS Changing the propagation type of an existing mount
410 If
411 .IR mountflags
412 includes one of
413 .BR MS_SHARED ,
414 .BR MS_PRIVATE ,
415 .BR MS_SLAVE ,
416 or
417 .BR MS_UNBINDABLE
418 (all available since Linux 2.6.15),
419 then the propagation type of an existing mount is changed.
420 If more than one of these flags is specified, an error results.
421
422 The only flags that can be used with changing the propagation type are
423 .BR MS_REC
424 and
425 .BR MS_SILENT .
426
427 The
428 .IR source ,
429 .IR filesystemtype ,
430 and
431 .IR data
432 arguments are ignored.
433
434 The meanings of the propagation type flags are as follows:
435 .TP
436 .BR MS_SHARED
437 Make this mount point shared.
438 Mount and unmount events immediately under this mount point will propagate
439 to the other mount points that are members of this mount's peer group.
440 Propagation here means that the same mount or unmount will automatically
441 occur under all of the other mount points in the peer group.
442 Conversely, mount and unmount events that take place under
443 peer mount points will propagate to this mount point.
444 .TP
445 .BR MS_PRIVATE
446 Make this mount point private.
447 Mount and unmount events do not propagate into or out of this mount point.
448 This is the default propagation type for newly created mount points.
449 .TP
450 .BR MS_SLAVE
451 If this is a shared mount point that is a member of a peer group
452 that contains other members, convert it to a slave mount.
453 If this is a shared mount point that is a member of a peer group
454 that contains no other members, convert it to a private mount.
455 Otherwise, the propagation type of the mount point is left unchanged.
456
457 When a mount point is a slave,
458 mount and unmount events propagate into this mount point from
459 the (master) shared peer group of which it was formerly a member.
460 Mount and unmount events under this mount point do not propagate to any peer.
461
462 A mount point can be the slave of another peer group
463 while at the same time sharing mount and unmount events
464 with a peer group of which it is a member.
465 .TP
466 .BR MS_UNBINDABLE
467 Make this mount unbindable.
468 This is like a private mount,
469 and in addition this mount can't be bind mounted.
470 When a recursive bind mount
471 .RB ( mount ()
472 with the
473 .BR MS_BIND
474 and
475 .BR MS_REC
476 flags) is performed on a directory subtree,
477 any bind mounts within the subtree are automatically pruned
478 (i.e., not replicated)
479 when replicating that subtree to produce the target subtree.
480 .PP
481 By default, changing the propagation type affects only the
482 .I target
483 mount point.
484 If the
485 .B MS_REC
486 flag is also specified in
487 .IR mountflags ,
488 then the propagation type of all mount points under
489 .IR target
490 is also changed.
491
492 For further details regarding mount propagation types, see
493 .BR mount_namespaces (7).
494 .\"
495 .SS Moving a mount
496 If
497 .I mountflags
498 contains the flag
499 .BR MS_MOVE
500 (available since Linux 2.4.18),
501 then move a subtree:
502 .I source
503 specifies an existing mount point and
504 .I target
505 specifies the new location to which that mount point is to be relocated.
506 The move is atomic: at no point is the subtree unmounted.
507
508 The remaining bits in the
509 .IR mountflags
510 argument are ignored, as are the
511 .IR filesystemtype
512 and
513 .IR data
514 arguments.
515 .\"
516 .SS Creating a new mount point
517 If none of
518 .BR MS_REMOUNT ,
519 .BR MS_BIND ,
520 .BR MS_MOVE ,
521 .BR MS_SHARED ,
522 .BR MS_PRIVATE ,
523 .BR MS_SLAVE ,
524 or
525 .BR MS_UNBINDABLE
526 is specified in
527 .IR mountflags ,
528 then
529 .BR mount ()
530 performs its default action: creating a new mount point.
531 .IR source
532 specifies the source for the new mount point, and
533 .IR target
534 specifies the directory at which to create the mount point.
535
536 The
537 .I filesystemtype
538 and
539 .I data
540 arguments are employed, and further bits may be specified in
541 .IR mountflags
542 to modify the behavior of the call.
543 .\"
544 .SH RETURN VALUE
545 On success, zero is returned.
546 On error, \-1 is returned, and
547 .I errno
548 is set appropriately.
549 .SH ERRORS
550 The error values given below result from filesystem type independent
551 errors.
552 Each filesystem type may have its own special errors and its
553 own special behavior.
554 See the Linux kernel source code for details.
555 .TP
556 .B EACCES
557 A component of a path was not searchable.
558 (See also
559 .BR path_resolution (7).)
560 .TP
561 .B EACCES
562 Mounting a read-only filesystem was attempted without giving the
563 .B MS_RDONLY
564 flag.
565 .TP
566 .B EACCES
567 The block device
568 .I source
569 is located on a filesystem mounted with the
570 .B MS_NODEV
571 option.
572 .\" mtk: Probably: write permission is required for MS_BIND, with
573 .\" the error EPERM if not present; CAP_DAC_OVERRIDE is required.
574 .TP
575 .B EBUSY
576 .I source
577 is already mounted.
578 .TP
579 .B EBUSY
580 .I source
581 cannot be remounted read-only,
582 because it still holds files open for writing.
583 .TP
584 .B EBUSY
585 .I source
586 cannot be mounted on
587 .I target
588 because
589 .I target
590 is still busy (it is the working directory of some thread,
591 the mount point of another device, has open files, etc.).
592 .TP
593 .B EFAULT
594 One of the pointer arguments points outside the user address space.
595 .TP
596 .B EINVAL
597 .I source
598 had an invalid superblock.
599 .TP
600 .B EINVAL
601 A remount operation
602 .RB ( MS_REMOUNT )
603 was attempted, but
604 .I source
605 was not already mounted on
606 .IR target .
607 .TP
608 .B EINVAL
609 A move operation
610 .RB ( MS_MOVE )
611 was attempted, but
612 .I source
613 was not a mount point, or was \(aq/\(aq.
614 .TP
615 .B EINVAL
616 .I mountflags
617 includes more than one of
618 .BR MS_SHARED ,
619 .BR MS_PRIVATE ,
620 .BR MS_SLAVE ,
621 or
622 .BR MS_UNBINDABLE .
623 .TP
624 .B EINVAL
625 .I mountflags
626 includes
627 .BR MS_SHARED ,
628 .BR MS_PRIVATE ,
629 .BR MS_SLAVE ,
630 or
631 .BR MS_UNBINDABLE
632 and also includes a flag other than
633 .BR MS_REC
634 or
635 .BR MS_SILENT .
636 .TP
637 .BR EINVAL
638 An attempt was made to bind mount an unbindable mount.
639 .TP
640 .B ELOOP
641 Too many links encountered during pathname resolution.
642 .TP
643 .B ELOOP
644 A move operation was attempted, and
645 .I target
646 is a descendant of
647 .IR source .
648 .TP
649 .B EMFILE
650 (In case no block device is required:)
651 Table of dummy devices is full.
652 .TP
653 .B ENAMETOOLONG
654 A pathname was longer than
655 .BR MAXPATHLEN .
656 .TP
657 .B ENODEV
658 .I filesystemtype
659 not configured in the kernel.
660 .TP
661 .B ENOENT
662 A pathname was empty or had a nonexistent component.
663 .TP
664 .B ENOMEM
665 The kernel could not allocate a free page to copy filenames or data into.
666 .TP
667 .B ENOTBLK
668 .I source
669 is not a block device (and a device was required).
670 .TP
671 .B ENOTDIR
672 .IR target ,
673 or a prefix of
674 .IR source ,
675 is not a directory.
676 .TP
677 .B ENXIO
678 The major number of the block device
679 .I source
680 is out of range.
681 .TP
682 .B EPERM
683 The caller does not have the required privileges.
684 .SH VERSIONS
685 The definitions of
686 .BR MS_DIRSYNC ,
687 .BR MS_MOVE ,
688 .BR MS_PRIVATE ,
689 .BR MS_REC ,
690 .BR MS_RELATIME ,
691 .BR MS_SHARED ,
692 .BR MS_SLAVED ,
693 .BR MS_STRICTATIME
694 and
695 .BR MS_UNBINDABLE
696 were added to glibc headers in version 2.12.
697 .\"
698 .SH CONFORMING TO
699 This function is Linux-specific and should not be used in
700 programs intended to be portable.
701 .SH NOTES
702 Since Linux 2.4 a single filesystem can be mounted at
703 multiple mount points, and multiple mounts can be stacked
704 on the same mount point.
705 .\" Multiple mounts on same mount point: since 2.3.99pre7.
706
707 The
708 .I mountflags
709 argument may have the magic number 0xC0ED (\fBMS_MGC_VAL\fP)
710 in the top 16 bits.
711 (All of the other flags discussed in DESCRIPTION
712 occupy the low order 16 bits of
713 .IR mountflags .)
714 Specifying
715 .BR MS_MGC_VAL
716 was required in kernel versions prior to 2.4,
717 but since Linux 2.4 is no longer required and is ignored if specified.
718
719 The original
720 .B MS_SYNC
721 flag was renamed
722 .B MS_SYNCHRONOUS
723 in 1.1.69
724 when a different
725 .B MS_SYNC
726 was added to \fI<mman.h>\fP.
727 .LP
728 Before Linux 2.4 an attempt to execute a set-user-ID or set-group-ID program
729 on a filesystem mounted with
730 .B MS_NOSUID
731 would fail with
732 .BR EPERM .
733 Since Linux 2.4 the set-user-ID and set-group-ID bits are
734 just silently ignored in this case.
735 .\" The change is in patch-2.4.0-prerelease.
736 .\"
737
738 .SS Per-process namespaces
739 Starting with kernel 2.4.19, Linux provides
740 per-process mount namespaces.
741 A mount namespace is the set of filesystem mounts that
742 are visible to a process.
743 Mount-point namespaces can be (and usually are)
744 shared between multiple processes,
745 and changes to the namespace (i.e., mounts and unmounts) by one process
746 are visible to all other processes sharing the same namespace.
747 (The pre-2.4.19 Linux situation can be considered as one in which
748 a single namespace was shared by every process on the system.)
749
750 A child process created by
751 .BR fork (2)
752 shares its parent's mount namespace;
753 the mount namespace is preserved across an
754 .BR execve (2).
755
756 A process can obtain a private mount namespace if:
757 it was created using the
758 .BR clone (2)
759 .BR CLONE_NEWNS
760 flag,
761 in which case its new namespace is initialized to be a
762 .I copy
763 of the namespace of the process that called
764 .BR clone (2);
765 or it calls
766 .BR unshare (2)
767 with the
768 .BR CLONE_NEWNS
769 flag,
770 which causes the caller's mount namespace to obtain a private copy
771 of the namespace that it was previously sharing with other processes,
772 so that future mounts and unmounts by the caller are invisible
773 to other processes (except child processes that the caller
774 subsequently creates) and vice versa.
775
776 The Linux-specific
777 .I /proc/[pid]/mounts
778 file exposes the list of mount points in the mount
779 namespace of the process with the specified ID; see
780 .BR proc (5)
781 for details.
782 .SH SEE ALSO
783 .BR umount (2),
784 .BR mount_namespaces (7),
785 .BR path_resolution (7),
786 .BR findmnt (8),
787 .BR lsblk (8),
788 .BR mount (8),
789 .BR umount (8)