[systemd-devel] Again, why this strange behavior implied by "auto" in fstab ?

Franck Bui fbui at suse.de
Tue Jan 23 14:47:21 UTC 2018


Hi,

I'm resurrecting an old but recurrent issue here which I'd like to
clarify one more time.

Basically, systemd mounts all filesystems listed in /etc/fstab (unless
"noauto" is used) which is good since that's how fstab was used when
SysV was the init system.

However it also introduced another "feature" which basically
automagically mounts a filesystem (listed in fstab) every time its
backend device re-appears.

And this part confuses a lot of users since fstab has always been used
to list filesystems that should be mounted during the boot process
only. It has never been the place used by disk managers to list
mount-points that should be automatically mounted after the system
booted.

Furthermore, it complicates the disk administrative tasks because now
one needs to be careful when it creates and initialize partitions
because systemd can mount the partition on the back of the user. We
recently had one such bug report (again).

According to Lennart[1], this feature is there because:

  "mount it if it is around at boot, but not later" is not
  available, since the idea is not compatible with modern
  storage.

I'm not sure why the old behavior is not compatible with modern
storage but with the following trivial change:

   static bool mount_is_auto(const MountParameters *p) {
           assert(p);

  -        return !fstab_test_option(p->options, "noauto\0");
  +        return fstab_test_option(p->options, "auto\0");
   }

it seems to me that it could have the best of both worlds.

The change basically redefines the meaning of "auto" option, which I
assumed was introduced by systemd since only "noauto" is described in
fstab(5) man page.

"auto" is used to enable the magic/odd feature "mount a filesystem
(listed in fstab) every times its backend device appears. This can
happen during the boot process or any time later". And this option is
assumed by default.

With the above change "auto" wouldn't affect the boot process: the
filesystem would be mounted during the boot process as usual unless
"noauto" is used. However if "auto" is not used, the magic feature is
disabled. And this would be the default.

This should meet most users expectations: by default a filesystem
listed in fstab is mounted during the boot process only once. No more
magic after.

If "nofail" is used, then PID1 wouldn't wait for the device to appear
during the boot process and would leave the mount unit waiting in the
background until the device appears or a timeout expires. But the
mount unit wouldn't be started automatically if the device appears
once the timeout has expired.

So the question is now: "what am I missing ?"

Thanks.

[1]
https://lists.freedesktop.org/archives/systemd-devel/2014-August/022285.html


More information about the systemd-devel mailing list