Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 2.08 KB

README.rst

File metadata and controls

61 lines (42 loc) · 2.08 KB

AutoMountNFS

A small systemd service I used for mounting NFS shares from a host on the local network using systemd and NetworkManager-dispatch on Arch Linux.

Why

Systemd has support for automounting NFS shares using the x-systemd-automount option. However, if the server is not found on the attached network, then the booting system will hang until systemd gives up trying to mount the missing shares. For wireless hosts, this is not acceptable.

How

With NetworkManager-dispatcher enabled, systemd will activate any scripts contained in /etc/NetworkManager/dispatcher.d. This is where 10-AutoMountNFS is installed. This script calls the AutoMountNFS systemd service which itself calls the automountnfs script that does the actual mounting. The automountnfs script checks for my nfs server, if it is found, then it attempts to mount the nfs shares. If it is not found, then it attempts to umount any mounted shares. Simple.

Additionally, AutoMountNFS uses systemd timers to run every minute. If the NFS host cannot be reached, then the NFS mounts are unmounted.

Install

  1. Clone

  2. makekpg -c

  3. pacman -U <compiled package>

  4. Make sure NetworkManager-dispatcher is enabled:

    systemctl enable NetworkManager-dispatcher
  5. Enable and start AutoMountNFS

    systemctl enable AutoMountNFS.timer
    systemctl start AutoMountNFS.timer
  6. Check /var/run/automountnfs for output.