6

If x-systemd.automount entries are modified in /etc/fstab, how do I get systemd to reparse the entries?

gerard
  • 293
  • 2
  • 7

1 Answers1

7

I could not find clear documentation on how to get systemd to reparse /etc/fstab automounts without rebooting, so:

  • systemctl daemon-reload will regenerate the units files in /run/systemd/generator but doesn't start new automounts or stop ones removed from fstab.
  • systemctl start newmount.automount will start the mount. The .automount extension is required, as systemd assumes .service if not extension is specified.
  • systemctl stop oldmount.automount will remove a mount not longer in fstab
  • systemctl reset-failed will stop a previously failed removed mount from appearing in status messages.
hayalci
  • 3,631
  • 3
  • 27
  • 37
gerard
  • 293
  • 2
  • 7
  • If you are removing a mount that previously failed it will still show up in `systemctl --failed` and `systemctl status oldmount` (with a suspicious `Loaded: not-found (Reason: No such file or directory)`). A `systemctl reset-failed` does the trick in this case. – dreua Jan 26 '22 at 11:06
  • @dreua, good info, added to answer. – gerard Jan 26 '22 at 20:26
  • Note that for adding a new mount point, even after `systemctl daemon-reload` the `systemctl list-units` doesn't show the new mount point, but _attempting_ to run `systemctl start` on the unit (after path mangling /srv/example -> `srv-example.automount`) it picks up the new unit. -- Search engine keyword stuffing: systemd automount pick up changes, systemd automount refresh after updating /etc/fstab – hayalci Aug 06 '23 at 16:25
  • I realize the unit was probably inactive and it would have showed in `systemctl list-units --type=automount --all` – hayalci Aug 06 '23 at 16:33