+
Note that *mount* does not pass this option to the **/sbin/mount.**__type__ helpers.
+*--exclusive*::
+Ensures that the filesystem is mounted as a unique instance and that the
+filesystem superblock is not reused by the kernel. The filesystem may be reused
+later if mounted without the option. The option affects only the current mount
+and is allowed for non-root users as well.
++
+See also the **--onlyonce** option. The difference between *--onlyonce* and
+*--exclusive* is that "onlyonce" ensures the same source is not mounted on the
+same mount point; this means mounting twice on /A is not allowed, but mounting
+on /A and /B is allowed. The "exclusive" mount ensures the filesystem itself is
+not reused, regardless of the mount point.
+
*-F*, *--fork*::
(Used in conjunction with *-a*.) Fork off a new incarnation of *mount* for each device. This will do the mounts on different devices or different NFS servers in parallel. This has the advantage that it is faster; also NFS timeouts proceed in parallel. A disadvantage is that the order of the mount operations is undefined. Thus, you cannot use this option if you want to mount both _/usr_ and _/usr/spool_.
For more details, see the *FILESYSTEM-INDEPENDENT MOUNT OPTIONS* and *FILESYSTEM-SPECIFIC MOUNT OPTIONS* sections.
*--onlyonce*::
-Forces *mount* command to check if the filesystem is already mounted. This behavior is the default for *--all*; otherwise, it depends on the kernel filesystem driver. Some filesystems may be mounted more than once on the same mount point (e.g. tmpfs).
+Forces *mount* command to check if the filesystem is already mounted on
+specified mountpoint. This behavior is the default for *--all*; otherwise, it
+depends on the kernel filesystem driver. Some filesystems may be mounted more
+than once on the same mount point (e.g. tmpfs). See also *--exclusive*.
*--options-mode* _mode_::
Controls how to combine options from _fstab_/_mtab_ with options from the command line. _mode_ can be one of *ignore*, *append*, *prepend* or *replace*. For example, *append* means that options from _fstab_ are appended to options from the command line. The default value is *prepend* -- it means command line options are evaluated after _fstab_ options. Note that the last option wins if there are conflicting ones.
fputs(USAGE_OPTIONS, out);
fputs(_(" -a, --all mount all filesystems mentioned in fstab\n"), out);
fputs(_(" -c, --no-canonicalize don't canonicalize paths\n"), out);
+ fputs(_(" --exclusive allow only one filesystem instance"), out);
fputs(_(" -f, --fake dry run; skip the mount(2) syscall\n"), out);
fputs(_(" -F, --fork fork off for each device (use with -a)\n"), out);
fputs(_(" -T, --fstab <path> alternative file to /etc/fstab\n"), out);
" mount options source\n"), out);
fputs(_(" --options-source-force\n"
" force use of options from fstab/mtab\n"), out);
- fputs(_(" --onlyonce check if filesystem is already mounted\n"), out);
+ fputs(_(" --onlyonce check if filesystem is already mounted on target\n"), out);
fputs(_(" -o, --options <list> comma-separated list of mount options\n"), out);
fputs(_(" -O, --test-opts <list> limit the set of filesystems (use with -a)\n"), out);
fputs(_(" -r, --read-only mount the filesystem read-only (same as -o ro)\n"), out);
MOUNT_OPT_OPTMODE,
MOUNT_OPT_OPTSRC,
MOUNT_OPT_OPTSRC_FORCE,
- MOUNT_OPT_ONLYONCE
+ MOUNT_OPT_ONLYONCE,
+ MOUNT_OPT_EXCL
};
static const struct option longopts[] = {
{ "all", no_argument, NULL, 'a' },
+ { "exclusive", no_argument, NULL, MOUNT_OPT_EXCL },
{ "fake", no_argument, NULL, 'f' },
{ "fstab", required_argument, NULL, 'T' },
{ "fork", no_argument, NULL, 'F' },
if (mnt_context_is_restricted(cxt) &&
!strchr("hlLUVvrist", c) &&
c != MOUNT_OPT_TARGET &&
- c != MOUNT_OPT_SOURCE)
+ c != MOUNT_OPT_SOURCE &&
+ c != MOUNT_OPT_EXCL)
suid_drop(cxt);
err_exclusive_options(c, longopts, excl, excl_st);
case MOUNT_OPT_ONLYONCE:
mnt_context_enable_onlyonce(cxt, 1);
break;
+ case MOUNT_OPT_EXCL:
+ mnt_context_enable_exclusive(cxt, 1);
+ break;
+
case 'h':
mnt_free_context(cxt);
usage();