1MOUNT(2) Linux Programmer's Manual MOUNT(2)
2
3
4
6 mount - mount filesystem
7
9 #include <sys/mount.h>
10
11 int mount(const char *source, const char *target,
12 const char *filesystemtype, unsigned long mountflags,
13 const void *data);
14
16 mount() attaches the filesystem specified by source (which is often a
17 pathname referring to a device, but can also be the pathname of a
18 directory or file, or a dummy string) to the location (a directory or
19 file) specified by the pathname in target.
20
21 Appropriate privilege (Linux: the CAP_SYS_ADMIN capability) is required
22 to mount filesystems.
23
24 Values for the filesystemtype argument supported by the kernel are
25 listed in /proc/filesystems (e.g., "btrfs", "ext4", "jfs", "xfs",
26 "vfat", "fuse", "tmpfs", "cgroup", "proc", "mqueue", "nfs", "cifs",
27 "iso9660"). Further types may become available when the appropriate
28 modules are loaded.
29
30 The data argument is interpreted by the different filesystems. Typi‐
31 cally it is a string of comma-separated options understood by this
32 filesystem. See mount(8) for details of the options available for each
33 filesystem type.
34
35 A call to mount() performs one of a number of general types of opera‐
36 tion, depending on the bits specified in mountflags. The choice of
37 which operation to perform is determined by testing the bits set in
38 mountflags, with the tests being conducted in the order listed here:
39
40 * Remount an existing mount: mountflags includes MS_REMOUNT.
41
42 * Create a bind mount: mountflags includes MS_BIND.
43
44 * Change the propagation type of an existing mount: mountflags
45 includes one of MS_SHARED, MS_PRIVATE, MS_SLAVE, or MS_UNBINDABLE.
46
47 * Move an existing mount to a new location: mountflags includes
48 MS_MOVE.
49
50 * Create a new mount: mountflags includes none of the above flags.
51
52 Each of these operations is detailed later in this page. Further flags
53 may be specified in mountflags to modify the behavior of mount(), as
54 described below.
55
56 Additional mount flags
57 The list below describes the additional flags that can be specified in
58 mountflags. Note that some operation types ignore some or all of these
59 flags, as described later in this page.
60
61 MS_DIRSYNC (since Linux 2.5.19)
62 Make directory changes on this filesystem synchronous. (This
63 property can be obtained for individual directories or subtrees
64 using chattr(1).)
65
66 MS_LAZYTIME (since Linux 4.0)
67 Reduce on-disk updates of inode timestamps (atime, mtime, ctime)
68 by maintain