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

Michael Chapman mike at very.puzzling.org
Thu Jan 25 20:05:49 UTC 2018


On Thu, 25 Jan 2018, Thomas Blume wrote:
[...]
> Suppressing the auto mount when a device (re)appears, is usually desired
> during some administrative tasks.
> What about lowering the hurdle for administrators by introducing a new
> systemctl command?
>
> Maybe something like:
>
> systemctl lock $DEVICE
>
> We could write the name of $DEVICE in some directory below /run/systemd.
> An udev rule could parse this directory when an add event for a device
> occurres and if $DEVICE matches, it could set SYSTEMD_READY=0.
> We would only need to make sure that SYSTEMD_READY gets reset back to 1 at 
> an:
>
> systemctl unlock $DEVICE
>
> That shouldn't be too hard to code either.
>
> Would this be an acceptable approach?

You could just use:

   systemctl --runtime mask path-to-mountpoint.mount

Or even:

   systemctl --runtime mask /path/to/mountpoint

if systemd already has the mount unit loaded. That should prevent the 
mount unit from being started -- i.e. prevent systemd from mounting the 
filesystem.

The --runtime option ensures that the mask will go away upon the next 
reboot, even if the admin forgets to call "systemctl --runtime unmask".


More information about the systemd-devel mailing list