Home Explore Blog CI



man-pages

5th chunk of `mount.man`
248fea6d32ae8a75b0508fa473d50ff925bf369de0f886590000000100000fab
 userspace
       mount options (e.g., _netdev) will not be copied by mount and it’s
       necessary to explicitly specify the options on the mount command line.

       Since util-linux 2.27 mount permits changing the mount options by
       passing the relevant options along with --bind. For example:

          mount -o bind,ro foo foo

       This feature is not supported by the Linux kernel; it is implemented in
       userspace by an additional mount(2) remounting system call. This
       solution is not atomic.

       The alternative (classic) way to create a read-only bind mount is to use
       the remount operation, for example:

          mount --bind olddir newdir

          mount -o remount,bind,ro olddir newdir

       Note that a read-only bind will create a read-only mountpoint (VFS
       entry), but the original filesystem superblock will still be writable,
       meaning that the olddir will be writable, but the newdir will be
       read-only.

       It’s also possible to change nosuid, nodev, noexec, noatime, nodiratime,
       relatime and nosymfollow VFS entry flags via a "remount,bind" operation.
       The other flags (for example filesystem-specific flags) are silently
       ignored. The classic mount(2) system call does not allow to change mount
       options recursively (for example with -o rbind,ro). The recursive
       semantic is possible with a new mount_setattr(2) kernel system call and
       it’s supported since libmount from util-linux v2.39 by a new
       experimental "recursive" option argument (e.g. -o rbind,ro=recursive).
       For more details see the FILESYSTEM-INDEPENDENT MOUNT OPTIONS section.

       Since util-linux 2.31, mount ignores the bind flag from /etc/fstab on a
       remount operation (if -o remount is specified on command line). This is
       necessary to fully control mount options on remount by command line. In
       previous versions the bind flag has been always applied and it was
       impossible to re-define mount options without interaction with the bind
       semantic. This mount behavior does not affect situations when
       "remount,bind" is specified in the /etc/fstab file.

   The move operation
       Move a mounted tree to another place (atomically). The call is:

          mount --move olddir newdir

       This will cause the contents which previously appeared under olddir to
       now be accessible under newdir. The physical location of the files is
       not changed. Note that olddir has to be a mountpoint.

       Note also that moving a mount residing under a shared mount is invalid
       and unsupported. Use findmnt -o TARGET,PROPAGATION to see the current
       propagation flags.

   Shared subtree operations
       Since Linux 2.6.15 it is possible to mark a mount and its submounts as
       shared, private, slave or unbindable. A shared mount provides the
       ability to create mirrors of that mount such that mounts and unmounts
       within any of the mirrors propagate to the other mirror. A slave mount
       receives propagation from its master, but not vice versa. A private
       mount carries no propagation abilities. An unbindable mount is a private
       mount which cannot be cloned through a bind operation. The detailed
       semantics are documented in Documentation/filesystems/sharedsubtree.txt
       file in the kernel source tree; see also mount_namespaces(7).

       Supported operations are:

           mount --make-shared mountpoint
           mount --make-slave mountpoint
           mount --make-private mountpoint
           mount --make-unbindable mountpoint

       The following commands allow one to recursively change the type of all
       the mounts under a given mountpoint.

           mount --make-rshared mountpoint
           mount --make-rslave mountpoint
           mount --make-rprivate mountpoint
           mount --make-runbindable mountpoint

       mount does not read fstab(5) when a --make-* operation

Title: More on Bind Mounts, Move Operations, and Shared Subtrees
Summary
This section continues the discussion of bind mounts, elaborating on changing VFS entry flags, specifically nosuid, nodev, noexec, noatime, nodiratime, relatime, and nosymfollow, via a "remount,bind" operation. It also introduces a new recursive option for changing mount options recursively using mount_setattr(2). The section then discusses the '--move' operation, which allows moving a mounted tree to another location atomically. Finally, the section covers shared subtree operations, introducing shared, private, slave, and unbindable mounts and commands to recursively change the type of all mounts under a mountpoint.