-
Notifications
You must be signed in to change notification settings - Fork 0
/
mount.html
1089 lines (816 loc) · 32.6 KB
/
mount.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!-- Creator : groff version 1.22.4 -->
<!-- CreationDate: Wed Jan 29 11:26:53 2020 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
h1 { text-align: center }
</style>
<title>MOUNT</title>
</head>
<body>
<h1 align="center">MOUNT</h1>
<a href="#NAME">NAME</a><br>
<a href="#SYNOPSIS">SYNOPSIS</a><br>
<a href="#DESCRIPTION">DESCRIPTION</a><br>
<a href="#RETURN VALUE">RETURN VALUE</a><br>
<a href="#ERRORS">ERRORS</a><br>
<a href="#VERSIONS">VERSIONS</a><br>
<a href="#CONFORMING TO">CONFORMING TO</a><br>
<a href="#NOTES">NOTES</a><br>
<a href="#SEE ALSO">SEE ALSO</a><br>
<a href="#COLOPHON">COLOPHON</a><br>
<hr>
<h2>NAME
<a name="NAME"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">mount - mount
filesystem</p>
<h2>SYNOPSIS
<a name="SYNOPSIS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>#include
<sys/mount.h></b></p>
<p style="margin-left:11%; margin-top: 1em"><b>int
mount(const char *</b><i>source</i><b>, const char
*</b><i>target</i><b>, <br>
const char *</b><i>filesystemtype</i><b>, unsigned long</b>
<i>mountflags</i><b>, <br>
const void *</b><i>data</i><b>);</b></p>
<h2>DESCRIPTION
<a name="DESCRIPTION"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em"><b>mount</b>()
attaches the filesystem specified by <i>source</i> (which is
often a pathname referring to a device, but can also be the
pathname of a directory or file, or a dummy string) to the
location (a directory or file) specified by the pathname in
<i>target</i>.</p>
<p style="margin-left:11%; margin-top: 1em">Appropriate
privilege (Linux: the <b>CAP_SYS_ADMIN</b> capability) is
required to mount filesystems.</p>
<p style="margin-left:11%; margin-top: 1em">Values for the
<i>filesystemtype</i> argument supported by the kernel are
listed in <i>/proc/filesystems</i> (e.g., "btrfs",
"ext4", "jfs", "xfs",
"vfat", "fuse", "tmpfs",
"cgroup", "proc", "mqueue",
"nfs", "cifs", "iso9660").
Further types may become available when the appropriate
modules are loaded.</p>
<p style="margin-left:11%; margin-top: 1em">The <i>data</i>
argument is interpreted by the different filesystems.
Typically it is a string of comma-separated options
understood by this filesystem. See <b>mount</b>(8) for
details of the options available for each filesystem
type.</p>
<p style="margin-left:11%; margin-top: 1em">A call to
<b>mount</b>() performs one of a number of general types of
operation, depending on the bits specified in
<i>mountflags</i>. The choice of which operation to perform
is determined by testing the bits set in <i>mountflags</i>,
with the tests being conducted in the order listed here:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p>*</p></td>
<td width="3%"></td>
<td width="85%">
<p>Remount an existing mount: <i>mountflags</i> includes
<b>MS_REMOUNT</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p>*</p></td>
<td width="3%"></td>
<td width="85%">
<p>Create a bind mount: <i>mountflags</i> includes
<b>MS_BIND</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p>*</p></td>
<td width="3%"></td>
<td width="85%">
<p>Change the propagation type of an existing mount:
<i>mountflags</i> includes one of <b>MS_SHARED</b>,
<b>MS_PRIVATE</b>, <b>MS_SLAVE</b>, or
<b>MS_UNBINDABLE</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p>*</p></td>
<td width="3%"></td>
<td width="85%">
<p>Move an existing mount to a new location:
<i>mountflags</i> includes <b>MS_MOVE</b>.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p>*</p></td>
<td width="3%"></td>
<td width="85%">
<p>Create a new mount: <i>mountflags</i> includes none of
the above flags.</p></td></tr>
</table>
<p style="margin-left:11%; margin-top: 1em">Each of these
operations is detailed later in this page. Further flags may
be specified in <i>mountflags</i> to modify the behavior of
<b>mount</b>(), as described below.</p>
<p style="margin-left:11%; margin-top: 1em"><b>Additional
mount flags</b> <br>
The list below describes the additional flags that can be
specified in <i>mountflags</i>. Note that some operation
types ignore some or all of these flags, as described later
in this page. <b><br>
MS_DIRSYNC</b> (since Linux 2.5.19)</p>
<p style="margin-left:22%;">Make directory changes on this
filesystem synchronous. (This property can be obtained for
individual directories or subtrees using
<b>chattr</b>(1).)</p>
<p style="margin-left:11%;"><b>MS_LAZYTIME</b> (since Linux
4.0)</p>
<p style="margin-left:22%;">Reduce on-disk updates of inode
timestamps (atime, mtime, ctime) by maintaining these
changes only in memory. The on-disk timestamps are updated
only when:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="22%"></td>
<td width="4%">
<p>(a)</p></td>
<td width="3%"></td>
<td width="71%">
<p>the inode needs to be updated for some change unrelated
to file timestamps;</p></td></tr>
<tr valign="top" align="left">
<td width="22%"></td>
<td width="4%">
<p>(b)</p></td>
<td width="3%"></td>
<td width="71%">
<p>the application employs <b>fsync</b>(2),
<b>syncfs</b>(2), or <b>sync</b>(2);</p></td></tr>
<tr valign="top" align="left">
<td width="22%"></td>
<td width="4%">
<p>(c)</p></td>
<td width="3%"></td>
<td width="71%">
<p>an undeleted inode is evicted from memory; or</p></td></tr>
<tr valign="top" align="left">
<td width="22%"></td>
<td width="4%">
<p>(d)</p></td>
<td width="3%"></td>
<td width="71%">
<p>more than 24 hours have passed since the inode was
written to disk.</p></td></tr>
</table>
<p style="margin-left:22%; margin-top: 1em">This mount
option significantly reduces writes needed to update the
inode’s timestamps, especially mtime and atime.
However, in the event of a system crash, the atime and mtime
fields on disk might be out of date by up to 24 hours.</p>
<p style="margin-left:22%; margin-top: 1em">Examples of
workloads where this option could be of significant benefit
include frequent random writes to preallocated files, as
well as cases where the <b>MS_STRICTATIME</b> mount option
is also enabled. (The advantage of combining
<b>MS_STRICTATIME</b> and <b>MS_LAZYTIME</b> is that
<b>stat</b>(2) will return the correctly updated atime, but
the atime updates will be flushed to disk only in the cases
listed above.)</p>
<p style="margin-left:11%;"><b>MS_MANDLOCK</b></p>
<p style="margin-left:22%;">Permit mandatory locking on
files in this filesystem. (Mandatory locking must still be
enabled on a per-file basis, as described in
<b>fcntl</b>(2).) Since Linux 4.5, this mount option
requires the <b>CAP_SYS_ADMIN</b> capability and a kernel
configured with the <b>CONFIG_MANDATORY_FILE_LOCKING</b>
option.</p>
<p style="margin-left:11%;"><b>MS_NOATIME</b></p>
<p style="margin-left:22%;">Do not update access times for
(all types of) files on this filesystem.</p>
<p style="margin-left:11%;"><b>MS_NODEV</b></p>
<p style="margin-left:22%;">Do not allow access to devices
(special files) on this filesystem.</p>
<p style="margin-left:11%;"><b>MS_NODIRATIME</b></p>
<p style="margin-left:22%;">Do not update access times for
directories on this filesystem. This flag provides a subset
of the functionality provided by <b>MS_NOATIME</b>; that is,
<b>MS_NOATIME</b> implies <b>MS_NODIRATIME</b>.</p>
<p style="margin-left:11%;"><b>MS_NOEXEC</b></p>
<p style="margin-left:22%;">Do not allow programs to be
executed from this filesystem.</p>
<p style="margin-left:11%;"><b>MS_NOSUID</b></p>
<p style="margin-left:22%;">Do not honor set-user-ID and
set-group-ID bits or file capabilities when executing
programs from this filesystem.</p>
<p style="margin-left:11%;"><b>MS_RDONLY</b></p>
<p style="margin-left:22%;">Mount filesystem read-only.</p>
<p style="margin-left:11%;"><b>MS_REC</b> (since Linux
2.4.11)</p>
<p style="margin-left:22%;">Used in conjunction with
<b>MS_BIND</b> to create a recursive bind mount, and in
conjunction with the propagation type flags to recursively
change the propagation type of all of the mounts in a
subtree. See below for further details.</p>
<p style="margin-left:11%;"><b>MS_RELATIME</b> (since Linux
2.6.20)</p>
<p style="margin-left:22%;">When a file on this filesystem
is accessed, update the file’s last access time
(atime) only if the current value of atime is less than or
equal to the file’s last modification time (mtime) or
last status change time (ctime). This option is useful for
programs, such as <b>mutt</b>(1), that need to know when a
file has been read since it was last modified. Since Linux
2.6.30, the kernel defaults to the behavior provided by this
flag (unless <b>MS_NOATIME</b> was specified), and the
<b>MS_STRICTATIME</b> flag is required to obtain traditional
semantics. In addition, since Linux 2.6.30, the file’s
last access time is always updated if it is more than 1 day
old.</p>
<p style="margin-left:11%;"><b>MS_SILENT</b> (since Linux
2.6.17)</p>
<p style="margin-left:22%;">Suppress the display of certain
(<i>printk</i>()) warning messages in the kernel log. This
flag supersedes the misnamed and obsolete <b>MS_VERBOSE</b>
flag (available since Linux 2.4.12), which has the same
meaning.</p>
<p style="margin-left:11%;"><b>MS_STRICTATIME</b> (since
Linux 2.6.30)</p>
<p style="margin-left:22%;">Always update the last access
time (atime) when files on this filesystem are accessed.
(This was the default behavior before Linux 2.6.30.)
Specifying this flag overrides the effect of setting the
<b>MS_NOATIME</b> and <b>MS_RELATIME</b> flags.</p>
<p style="margin-left:11%;"><b>MS_SYNCHRONOUS</b></p>
<p style="margin-left:22%;">Make writes on this filesystem
synchronous (as though the <b>O_SYNC</b> flag to
<b>open</b>(2) was specified for all file opens to this
filesystem).</p>
<p style="margin-left:11%; margin-top: 1em">From Linux 2.4
onward, some of the above flags are settable on a per-mount
basis, while others apply to the superblock of the mounted
filesystem, meaning that all mounts of the same filesystem
share those flags. (Previously, all of the flags were
per-superblock.)</p>
<p style="margin-left:11%; margin-top: 1em">The
per-mount-point flags are as follows:</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p>*</p></td>
<td width="3%"></td>
<td width="85%">
<p>Since Linux 2.4: <b>MS_NODEV</b>, <b>MS_NOEXEC</b>, and
<b>MS_NOSUID</b> flags are settable on a per-mount-point
basis.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p>*</p></td>
<td width="3%"></td>
<td width="85%">
<p>Since Linux 2.6.16: <b>MS_NOATIME</b> and
<b>MS_NODIRATIME</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="1%">
<p>*</p></td>
<td width="3%"></td>
<td width="85%">
<p>Since Linux 2.6.20: <b>MS_RELATIME</b>.</p></td></tr>
</table>
<p style="margin-left:11%; margin-top: 1em">The following
flags are per-superblock: <b>MS_DIRSYNC</b>,
<b>MS_LAZYTIME</b>, <b>MS_MANDLOCK</b>, <b>MS_MS_SILENT</b>,
and <b>MS_SYNCHRONOUS</b>. The initial settings of these
flags are determined on the first mount of the filesystem,
and will be shared by all subsequent mounts of the same
filesystem. Subsequently, the settings of the flags can be
changed via a remount operation (see below). Such changes
will be visible via all mount points associated with the
filesystem.</p>
<p style="margin-left:11%; margin-top: 1em">Since Linux
2.6.16, <b>MS_RDONLY</b> can be set or cleared on a
per-mount-point basis as well as on the underlying
filesystem superblock. The mounted filesystem will be
writable only if neither the filesystem nor the mountpoint
are flagged as read-only.</p>
<p style="margin-left:11%; margin-top: 1em"><b>Remounting
an existing mount</b> <br>
An existing mount may be remounted by specifying
<b>MS_REMOUNT</b> in <i>mountflags</i>. This allows you to
change the <i>mountflags</i> and <i>data</i> of an existing
mount without having to unmount and remount the filesystem.
<i>target</i> should be the same value specified in the
initial <b>mount</b>() call.</p>
<p style="margin-left:11%; margin-top: 1em">The
<i>source</i> and <i>filesystemtype</i> arguments are
ignored.</p>
<p style="margin-left:11%; margin-top: 1em">The
<i>mountflags</i> and <i>data</i> arguments should match the
values used in the original <b>mount</b>() call, except for
those parameters that are being deliberately changed.</p>
<p style="margin-left:11%; margin-top: 1em">The following
<i>mountflags</i> can be changed: <b>MS_LAZYTIME</b>,
<b>MS_MANDLOCK</b>, <b>MS_NOATIME</b>, <b>MS_NODEV</b>,
<b>MS_NODIRATIME</b>, <b>MS_NOEXEC</b>, <b>MS_NOSUID</b>,
<b>MS_RELATIME</b>, <b>MS_RDONLY</b>, <b>MS_STRICTATIME</b>
(whose effect is to clear the <b>MS_NOATIME</b> and
<b>MS_RELATIME</b> flags), and <b>MS_SYNCHRONOUS</b>.
Attempts to change the setting of the <b>MS_DIRSYNC</b> and
<b>MS_SILENT</b> flags during a remount are silently
ignored. Note that changes to per-superblock flags are
visible via all mount points of the associated filesystem
(because the per-superblock flags are shared by all mount
points).</p>
<p style="margin-left:11%; margin-top: 1em">Since Linux
3.17, if none of <b>MS_NOATIME</b>, <b>MS_NODIRATIME</b>,
<b>MS_RELATIME</b>, or <b>MS_STRICTATIME</b> is specified in
<i>mountflags</i>, then the remount operation preserves the
existing values of these flags (rather than defaulting to
<b>MS_RELATIME</b>).</p>
<p style="margin-left:11%; margin-top: 1em">Since Linux
2.6.26, the <b>MS_REMOUNT</b> flag can be used with
<b>MS_BIND</b> to modify only the per-mount-point flags.
This is particularly useful for setting or clearing the
"read-only" flag on a mount point without changing
the underlying filesystem. Specifying <i>mountflags</i>
as:</p>
<p style="margin-left:17%; margin-top: 1em">MS_REMOUNT |
MS_BIND | MS_RDONLY</p>
<p style="margin-left:11%; margin-top: 1em">will make
access through this mountpoint read-only, without affecting
other mount points.</p>
<p style="margin-left:11%; margin-top: 1em"><b>Creating a
bind mount</b> <br>
If <i>mountflags</i> includes <b>MS_BIND</b> (available
since Linux 2.4), then perform a bind mount. A bind mount
makes a file or a directory subtree visible at another point
within the single directory hierarchy. Bind mounts may cross
filesystem boundaries and span <b>chroot</b>(2) jails.</p>
<p style="margin-left:11%; margin-top: 1em">The
<i>filesystemtype</i> and <i>data</i> arguments are
ignored.</p>
<p style="margin-left:11%; margin-top: 1em">The remaining
bits (other than <b>MS_REC</b>, described below) in the
<i>mountflags</i> argument are also ignored. (The bind mount
has the same mount options as the underlying mount point.)
However, see the discussion of remounting above, for a
method of making an existing bind mount read-only.</p>
<p style="margin-left:11%; margin-top: 1em">By default,
when a directory is bind mounted, only that directory is
mounted; if there are any submounts under the directory
tree, they are not bind mounted. If the <b>MS_REC</b> flag
is also specified, then a recursive bind mount operation is
performed: all submounts under the <i>source</i> subtree
(other than unbindable mounts) are also bind mounted at the
corresponding location in the <i>target</i> subtree.</p>
<p style="margin-left:11%; margin-top: 1em"><b>Changing the
propagation type of an existing mount</b> <br>
If <i>mountflags</i> includes one of <b>MS_SHARED</b>,
<b>MS_PRIVATE</b>, <b>MS_SLAVE</b>, or <b>MS_UNBINDABLE</b>
(all available since Linux 2.6.15), then the propagation
type of an existing mount is changed. If more than one of
these flags is specified, an error results.</p>
<p style="margin-left:11%; margin-top: 1em">The only other
flags that can be specified while changing the propagation
type are <b>MS_REC</b> (described below) and
<b>MS_SILENT</b> (which is ignored).</p>
<p style="margin-left:11%; margin-top: 1em">The
<i>source</i>, <i>filesystemtype</i>, and <i>data</i>
arguments are ignored.</p>
<p style="margin-left:11%; margin-top: 1em">The meanings of
the propagation type flags are as follows: <b><br>
MS_SHARED</b></p>
<p style="margin-left:22%;">Make this mount point shared.
Mount and unmount events immediately under this mount point
will propagate to the other mount points that are members of
this mount’s peer group. Propagation here means that
the same mount or unmount will automatically occur under all
of the other mount points in the peer group. Conversely,
mount and unmount events that take place under peer mount
points will propagate to this mount point.</p>
<p style="margin-left:11%;"><b>MS_PRIVATE</b></p>
<p style="margin-left:22%;">Make this mount point private.
Mount and unmount events do not propagate into or out of
this mount point.</p>
<p style="margin-left:11%;"><b>MS_SLAVE</b></p>
<p style="margin-left:22%;">If this is a shared mount point
that is a member of a peer group that contains other
members, convert it to a slave mount. If this is a shared
mount point that is a member of a peer group that contains
no other members, convert it to a private mount. Otherwise,
the propagation type of the mount point is left
unchanged.</p>
<p style="margin-left:22%; margin-top: 1em">When a mount
point is a slave, mount and unmount events propagate into
this mount point from the (master) shared peer group of
which it was formerly a member. Mount and unmount events
under this mount point do not propagate to any peer.</p>
<p style="margin-left:22%; margin-top: 1em">A mount point
can be the slave of another peer group while at the same
time sharing mount and unmount events with a peer group of
which it is a member.</p>
<p style="margin-left:11%;"><b>MS_UNBINDABLE</b></p>
<p style="margin-left:22%;">Make this mount unbindable.
This is like a private mount, and in addition this mount
can’t be bind mounted. When a recursive bind mount
(<b>mount</b>() with the <b>MS_BIND</b> and <b>MS_REC</b>
flags) is performed on a directory subtree, any unbindable
mounts within the subtree are automatically pruned (i.e.,
not replicated) when replicating that subtree to produce the
target subtree.</p>
<p style="margin-left:11%; margin-top: 1em">By default,
changing the propagation type affects only the <i>target</i>
mount point. If the <b>MS_REC</b> flag is also specified in
<i>mountflags</i>, then the propagation type of all mount
points under <i>target</i> is also changed.</p>
<p style="margin-left:11%; margin-top: 1em">For further
details regarding mount propagation types (including the
default propagation type assigned to new mounts), see
<b>mount_namespaces</b>(7).</p>
<p style="margin-left:11%; margin-top: 1em"><b>Moving a
mount</b> <br>
If <i>mountflags</i> contains the flag <b>MS_MOVE</b>
(available since Linux 2.4.18), then move a subtree:
<i>source</i> specifies an existing mount point and
<i>target</i> specifies the new location to which that mount
point is to be relocated. The move is atomic: at no point is
the subtree unmounted.</p>
<p style="margin-left:11%; margin-top: 1em">The remaining
bits in the <i>mountflags</i> argument are ignored, as are
the <i>filesystemtype</i> and <i>data</i> arguments.</p>
<p style="margin-left:11%; margin-top: 1em"><b>Creating a
new mount point</b> <br>
If none of <b>MS_REMOUNT</b>, <b>MS_BIND</b>,
<b>MS_MOVE</b>, <b>MS_SHARED</b>, <b>MS_PRIVATE</b>,
<b>MS_SLAVE</b>, or <b>MS_UNBINDABLE</b> is specified in
<i>mountflags</i>, then <b>mount</b>() performs its default
action: creating a new mount point. <i>source</i> specifies
the source for the new mount point, and <i>target</i>
specifies the directory at which to create the mount
point.</p>
<p style="margin-left:11%; margin-top: 1em">The
<i>filesystemtype</i> and <i>data</i> arguments are
employed, and further bits may be specified in
<i>mountflags</i> to modify the behavior of the call.</p>
<h2>RETURN VALUE
<a name="RETURN VALUE"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">On success,
zero is returned. On error, -1 is returned, and <i>errno</i>
is set appropriately.</p>
<h2>ERRORS
<a name="ERRORS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The error
values given below result from filesystem type independent
errors. Each filesystem type may have its own special errors
and its own special behavior. See the Linux kernel source
code for details.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EACCES</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>A component of a path was not searchable. (See also
<b>path_resolution</b>(7).)</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EACCES</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>Mounting a read-only filesystem was attempted without
giving the <b>MS_RDONLY</b> flag.</p></td></tr>
</table>
<p style="margin-left:22%; margin-top: 1em">The file system
may be read-only for various reasons, including: it resides
on a read-only optical disk; it is resides on a device with
a physical switch that has been set to mark the device
read-only; the filesystem implementation was compiled with
read-only support; or errors were detected when initially
mounting the filesystem, so that it was marked read-only and
can’t be remounted as read-write (until the errors are
fixed).</p>
<p style="margin-left:22%; margin-top: 1em">Some
filesystems instead return the error <b>EROFS</b> on an
attempt to mount a read-only filesystem.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p style="margin-top: 1em"><b>EACCES</b></p></td>
<td width="2%"></td>
<td width="78%">
<p style="margin-top: 1em">The block device <i>source</i>
is located on a filesystem mounted with the <b>MS_NODEV</b>
option.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EBUSY</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>An attempt was made to stack a new mount directly on top
of an existing mount point that was created in this mount
namespace with the same <i>source</i> and <i>target</i>.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EBUSY</b></p></td>
<td width="2%"></td>
<td width="78%">
<p><i>source</i> cannot be remounted read-only, because it
still holds files open for writing.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EFAULT</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>One of the pointer arguments points outside the user
address space.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EINVAL</b></p></td>
<td width="2%"></td>
<td width="78%">
<p><i>source</i> had an invalid superblock.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EINVAL</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>A remount operation (<b>MS_REMOUNT</b>) was attempted,
but <i>source</i> was not already mounted on
<i>target</i>.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EINVAL</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>A move operation (<b>MS_MOVE</b>) was attempted, but the
mount tree under <i>source</i> includes unbindable mounts
and <i>target</i> is a mount point that has propagation type
<b>MS_SHARED</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EINVAL</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>A move operation (<b>MS_MOVE</b>) was attempted, but the
parent mount of <i>source</i> mount has propagation type
<b>MS_SHARED</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EINVAL</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>A move operation (<b>MS_MOVE</b>) was attempted, but
<i>source</i> was not a mount point, or was '/'.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EINVAL</b></p></td>
<td width="2%"></td>
<td width="78%">
<p><i>mountflags</i> includes more than one of
<b>MS_SHARED</b>, <b>MS_PRIVATE</b>, <b>MS_SLAVE</b>, or
<b>MS_UNBINDABLE</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EINVAL</b></p></td>
<td width="2%"></td>
<td width="78%">
<p><i>mountflags</i> includes <b>MS_SHARED</b>,
<b>MS_PRIVATE</b>, <b>MS_SLAVE</b>, or <b>MS_UNBINDABLE</b>
and also includes a flag other than <b>MS_REC</b> or
<b>MS_SILENT</b>.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EINVAL</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>An attempt was made to bind mount an unbindable
mount.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EINVAL</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>In an unprivileged mount namespace (i.e., a mount
namespace owned by a user namespace that was created by an
unprivileged user), a bind mount operation (<b>MS_BIND</b>)
was attempted without specifying (<b>MS_REC</b>), which
would have revealed the filesystem tree underneath one of
the submounts of the directory being bound.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ELOOP</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>Too many links encountered during pathname
resolution.</p> </td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ELOOP</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>A move operation was attempted, and <i>target</i> is a
descendant of <i>source</i>.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>EMFILE</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>(In case no block device is required:) Table of dummy
devices is full.</p></td></tr>
</table>
<p style="margin-left:11%;"><b>ENAMETOOLONG</b></p>
<p style="margin-left:22%;">A pathname was longer than
<b>MAXPATHLEN</b>.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ENODEV</b></p></td>
<td width="2%"></td>
<td width="78%">
<p><i>filesystemtype</i> not configured in the kernel.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ENOENT</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>A pathname was empty or had a nonexistent component.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="9%">
<p><b>ENOMEM</b></p></td>
<td width="2%"></td>
<td width="78%">
<p>The kernel could not allocate a free page to copy
filenames or data into.</p></td></tr>
</table>
<p style="margin-left:11%;"><b>ENOTBLK</b></p>
<p style="margin-left:22%;"><i>source</i> is not a block
device (and a device was required).</p>
<p style="margin-left:11%;"><b>ENOTDIR</b></p>
<p style="margin-left:22%;"><i>target</i>, or a prefix of
<i>source</i>, is not a directory.</p>
<table width="100%" border="0" rules="none" frame="void"
cellspacing="0" cellpadding="0">
<tr valign="top" align="left">
<td width="11%"></td>
<td width="7%">
<p><b>ENXIO</b></p></td>
<td width="4%"></td>
<td width="78%">
<p>The major number of the block device <i>source</i> is
out of range.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="7%">
<p><b>EPERM</b></p></td>
<td width="4%"></td>
<td width="78%">
<p>The caller does not have the required privileges.</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="7%">
<p><b>EROFS</b></p></td>
<td width="4%"></td>
<td width="78%">
<p>Mounting a read-only filesystem was attempted without
giving the <b>MS_RDONLY</b> flag. See <b>EACCES</b>,
above.</p> </td></tr>
</table>
<h2>VERSIONS
<a name="VERSIONS"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">The definitions
of <b>MS_DIRSYNC</b>, <b>MS_MOVE</b>, <b>MS_PRIVATE</b>,
<b>MS_REC</b>, <b>MS_RELATIME</b>, <b>MS_SHARED</b>,
<b>MS_SLAVE</b>, <b>MS_STRICTATIME</b>, and
<b>MS_UNBINDABLE</b> were added to glibc headers in version
2.12.</p>
<h2>CONFORMING TO
<a name="CONFORMING TO"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">This function
is Linux-specific and should not be used in programs
intended to be portable.</p>
<h2>NOTES
<a name="NOTES"></a>
</h2>
<p style="margin-left:11%; margin-top: 1em">Since Linux 2.4
a single filesystem can be mounted at multiple mount points,