Setup NFS Mount to Synology NAS

Why

We want to be able to auto-mount our NFS share in the event of unepected shutdowns and restarts.

Goal

Make sure the the NFS share is automounted each time the server restarts.

Enable NFS service on your Synology NAS

Before accessing a shared folder with your NFS client, you must change the settings on your Synology NAS to allow sharing via NFS. Follow the steps below:

  1. Go to Control Panel > File Services > NFS (for DSM 7.0 and above) or SMB/AFP/NFS (for DSM 6.2 and earlier).
  2. Tick Enable NFS service.
  3. Click Apply to save the settings.

Assign NFS permission to shared folders

Before accessing any shared folders with your NFS client, you must first configure the NFS permissions of the shared folder you wish to access. Follow the steps below to change NFS permissions of the shared folders on your Synology NAS:

  1. Go to Control Panel > Shared Folder.
  2. Select the shared folder that you want to access with your NFS client and click Edit.2
  3. Go to NFS Permissions and click Create.
  4. Refer to this article to edit the permission settings.
  5. Click Save (for DSM 7.0 and above) or OK (for DSM 6.2 and earlier) to save the rule.
  6. Click Save (for DSM 7.0 and above) or OK (for DSM 6.2 and earlier) to apply the NFS permissions.
  7. After applying the NFS permission, you can find the mount path of the shared folder at the bottom-left of the NFS Permissions tab. The mount path should be in the following format: /[volume name]/[shared folder name]

Mount NFS share to the server with autofs

1
2
# Create a folder to mount the NFS volume to.
mkdir -p /mnt/synology
1
2
# Install autofs
sudo apt install autofs

Several files should have been created: /etc/autofs.conf -> auto.master -> auto.nfs The should look somewhat like this.

1
2
# /etc/auto.nfs
/mnt/synology 192.168.1.x:/mountname/folder
1
2
# /etc/auto.master
/- /etc/auto.nfs
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# /etc/autofs.conf  For our purposes the only lines that matter are:
[ autofs ]
# master_map_name - default map name for the master map.
master_map_name = /etc/auto.master
timeout = 300
[ amd ]
# Override the internal default with the same timeout that
# is used by the override in the autofs configuration, sanity
# only change.
#
dismount_interval = 300