mount(2) System Calls Manual mount(2) mount - (libc -lc) #include int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *_Nullable data); mount() source ( ) ( ) target. ( : CAP_SYS_ADMIN) . filesystemtype /proc/filesystems ( "btrfs" "ext4" "jfs" "xfs" "vfat" "fuse" "tmpfs" "cgroup" "proc" "mqueue" "nfs" "cifs" "iso9660"). . data. . mount(8) . NULL . mount() mountflags. mountflags : o : mountflags MS_REMOUNT. o (bind mount): mountflags MS_BIND. o : mountflags MS_SHARED MS_PRIVATE MS_SLAVE MS_UNBINDABLE. o : mountflags MS_MOVE. o : mountflags . . mountflags mount() . mountflags. . MS_DIRSYNC ( 2.5.19) . ( chattr(1).) MS_LAZYTIME ( 4.0) (atime mtime ctime) . : o o fsync(2) syncfs(2) sync(2) o o 24 . mtime atime. atime mtime 24 . MS_STRICTATIME. ( MS_STRICTATIME MS_LAZYTIME stat(2) atime atime .) MS_MANDLOCK (mandatory locking) . ( fcntl(2).) 4.5 CAP_SYS_ADMIN CONFIG_MANDATORY_FILE_LOCKING. 5.15 . MS_NOATIME . MS_NODEV ( ) . MS_NODIRATIME . MS_NOATIME MS_NOATIME MS_NODIRATIME. MS_NOEXEC . MS_NOSUID set-user-ID set-group-ID . SELinux nosuid_transition nnp_nosuid_transition. MS_RDONLY . MS_REC ( 2.4.11) MS_BIND . . MS_RELATIME ( 2.6.20) (atime) atime (mtime) (ctime). mutt(1) . 2.6.30 ( MS_NOATIME) MS_STRICTATIME . 2.6.30 . MS_SILENT ( 2.6.17) (printk()) . MS_VERBOSE ( 2.4.12) . MS_STRICTATIME ( 2.6.30) (atime) . ( 2.6.30.) MS_NOATIME MS_RELATIME. MS_SYNCHRONOUS ( O_SYNC open(2) ). MS_NOSYMFOLLOW ( 5.10) . readlink(1) readlink(2) realpath(1) realpath(3) . 2.4 (superblock) . ( ). : o 2.4: MS_NODEV MS_NOEXEC MS_NOSUID . o 2.6.16: MS_NOATIME MS_NODIRATIME. o 2.6.20: MS_RELATIME. : MS_DIRSYNC MS_LAZYTIME MS_MANDLOCK MS_SILENT MS_SYNCHRONOUS. . ( ). . 2.6.16 MS_RDONLY . " ". MS_REMOUNT mountflags. mountflags data . target mount() . source filesystemtype. mountflags data mount() . mountflags : MS_LAZYTIME MS_MANDLOCK MS_NOATIME MS_NODEV MS_NODIRATIME MS_NOEXEC MS_NOSUID MS_RELATIME MS_RDONLY MS_STRICTATIME ( MS_NOATIME MS_RELATIME) MS_SYNCHRONOUS. MS_DIRSYNC MS_SILENT . ( ). 3.17 MS_NOATIME MS_NODIRATIME MS_RELATIME MS_STRICTATIME mountflags ( MS_RELATIME ). 2.6.26 MS_REMOUNT MS_BIND . " " . data. mountflags. mountflags ( ). mountflags : MS_REMOUNT | MS_BIND | MS_RDONLY ( ) . (bind mount) mountflags MS_BIND ( 2.4) . . chroot(2). filesystemtype data. ( MS_REC ) mountflags. ( ). . . MS_REC : source ( ) target . mountflags MS_SHARED MS_PRIVATE MS_SLAVE MS_UNBINDABLE ( 2.6.15) . . MS_REC ( ) MS_SILENT ( ). source filesystemtype data. : MS_SHARED . . . . MS_PRIVATE . . MS_SLAVE (slave). . . () . . . MS_UNBINDABLE . . (mount() MS_BIND MS_REC) ( ) . target . MS_REC mountflags target. ( ) mount_namespaces(7). mountflags MS_MOVE ( 2.4.18) : source target . : . mountflags filesystemtype data. MS_REMOUNT MS_BIND MS_MOVE MS_SHARED MS_PRIVATE MS_SLAVE MS_UNBINDABLE mountflags mount() : . source target . filesystemtype data mountflags . . -1 errno . . . . EACCES . ( path_resolution(7).) EACCES MS_RDONLY. : ( ). EROFS . EACCES source MS_NODEV. EBUSY source target. EBUSY source . EFAULT . EINVAL source . EINVAL (MS_REMOUNT) source target. EINVAL (MS_MOVE) source target MS_SHARED. EINVAL (MS_MOVE) source MS_SHARED. EINVAL (MS_MOVE) source '/'. EINVAL (MS_BIND) source ( /proc/pid/ns/mnt ) target MS_SHARED . EINVAL mountflags MS_SHARED MS_PRIVATE MS_SLAVE MS_UNBINDABLE. EINVAL mountflags MS_SHARED MS_PRIVATE MS_SLAVE MS_UNBINDABLE MS_REC MS_SILENT. EINVAL . EINVAL ( ) (MS_BIND) (MS_REC) . ELOOP . ELOOP target source. EMFILE ( :) . ENAMETOOLONG MAXPATHLEN. ENODEV filesystemtype . ENOENT . ENOMEM . ENOSPC . /proc/sys/fs/mount-max proc_sys_fs(5) . . mount_namespaces(7) . ENOTBLK source ( ). ENOTDIR target source . ENXIO source . EPERM . EPERM (MS_REMOUNT) MS_RDONLY MS_NOSUID MS_NOEXEC "atime" (MS_NOATIME MS_NODIRATIME MS_RELATIME) mount_namespaces(7). EROFS MS_RDONLY. EACCES . . MS_DIRSYNC MS_MOVE MS_PRIVATE MS_REC MS_RELATIME MS_SHARED MS_SLAVE MS_STRICTATIME MS_UNBINDABLE glibc glibc 2.12. 2.4 . mountflags 0xC0ED (MS_MGC_VAL) 16 . ( 16 mountflags). MS_MGC_VAL 2.4 2.4 . MS_SYNC MS_SYNCHRONOUS 1.1.69 MS_SYNC . 2.4 set-user-ID set-group-ID MS_NOSUID EPERM. 2.4 set-user-ID set-group-ID . 2.4.19 . . ( ) ( ) . ( 2.4.19 ). fork(2) execve(2). : CLONE_NEWNS clone(2) clone(2) unshare(2) CLONE_NEWNS ( ) . mount_namespaces(7). . . . . . /proc/pid/mountinfo ( ). /proc/pid/mounts /proc/pid/mountinfo /proc/pid/mounts . /proc/pid/mountinfo . proc(5) mount_namespaces(7) . mountpoint(1) chroot(2) FS_IOC_SETFLAGS(2const) mount_setattr(2) pivot_root(2) umount(2) mount_namespaces(7) path_resolution(7) findmnt(8) lsblk(8) mount(8) umount(8) 3 . . : . 6.18 11 2026 mount(2)