flag to determine what the
.B mount
command is trying to do. It can also be used to add entries for devices
-that were mounted earlier with the -n option.
+that were mounted earlier with the -n option. The -f option checks for
+existing record in /etc/mtab and fails when the record already
+exists (with regular non-fake mount, this check is done by kernel).
.TP
.B \-i
Don't call the /sbin/mount.<filesystem> helper even if it exists.
static const char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_encryption,
*opt_speed, *opt_comment, *opt_uhelper;
+static int mounted (const char *spec0, const char *node0);
+
static struct string_opt_map {
char *tag;
int skip;
suid_check(spec, node, &flags, &user);
+ /* The "mount -f" checks for for existing record in /etc/mtab (with
+ * regular non-fake mount this is usually done by kernel)
+ */
+ if (fake && mounted (spec, node))
+ die(EX_USAGE, _("mount: according to mtab, "
+ "%s is already mounted on %s\n"),
+ spec, node);
+
mount_opts = extra_opts;
if (opt_speed)