6

I recently found that (among others) network shares can be automatically mounted on access. In Ubuntu there are two options either using autofs or the automount feature of systemd.

Could perhaps someone tell me what the differences (apart from different configuration) between the two options are. Autofs seems to be more flexible as one can configure scripts for the automount locations. Is this possible using the systemd automount as well?


UPDATE 2017-07-25:

Just a brief update for everyone stumbling across this question.

I went with the systemd automount option as it is way more convenient and easier to configure, while providing nearly the same functionality.

If there is an fstab entry with noauto and x-systemd.automount reloading the systemd daemon (systemctrl daemon-reload) will generate an automount systemd unit under /run/systemd/generator/ (at least this is the path where it get's generated under ubuntu 16.04). The unit will be named after the mountpoint of the fstab entry. That is, if you create an automountpoint for /media/network/someserver/share there will be a systemd automount unit media-network-someserver-share.automount. This automount unit can then be (re-)started to activate the mountpoint using systemctl restart media-network-someserver-share.automount.

And you're done.

5

I think you've largely answered your own question.

Systemd thinks about most things in a "just in time" manager, so adding automount was an obvious extension. The configuration uses a common style, but isn't super flexible.

Autofs is the old way we used to do this. It's flexible, the config is kind of complex/weird, and it's probably not installed by default.

You probably want systemd unless your needs are complex. A simple automount setup guide is here: http://blog.tomecek.net/post/automount-with-systemd/

2

The main difference for me is that autofs, with the right auto scripts, will dynamically list the available shares. So you don't need to pre-define and hard-code which machines/shares should be made available.

With systemd's automount, only shares which you have pre-configured will be visible. Whether this is an advantage or a disadvantage depends on your environment, policy, use patterns etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.