Skip to content

demizer/AutoMountNFS

Repository files navigation

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.

About

Auto mount handling for NFS shares

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages