Monthly Archives: November 2016

Automounting NFS network shares

Automounting network shares when they are accessed or removable media when they are inserted. As I like NFS, this is my preffered solution, better then my old article using fstab.

Sources
Arch Linux
Red Hat
Server World

Installation
aptitude -y install autofs

Configuration
AutoFS uses template files for configuration which are located in /etc/autofs. The main template is called auto.master, which can point to one or more other templates for specific media types.

You can configure autofs to mount your media to a specific folder (/-), rather than inside a common folder (/media).

/etc/auto.master

#/media /etc/autofs/auto.media
/-    /etc/auto.mount

/etc/auto.mount

# create new: [mount point] [option] [location]
/disk -fstype=nfs,rw,rsize=8192,wsize=8192,timeo=14,intr  192.168.122.1:/disk

Restart AutoFS daemon:
systemctl restart autofs

Check if NFS export is mounted:
mount | grep /disk