User Tools

Site Tools


Using autofs to mount NFS share when needed

The problem I had with my personal cloud at home is that the raspberry pi boots faster than my NAS. So when the rpi was ready to synchronize the cloud with owncloud client, the share was not available yet.

So I decided to use autofs in order to be able to mount the NFS share when it is available.

First install autofs:

sudo apt-get install autofs5

Then, configure master file in order to point to a nfs configuration file. At then end of /etc/auto.master, add this:

/mnt	/etc/auto.nfs	--ghost,--timeout=30

/mnt is the folder where all shares will be mounted.

Then, create file /etc/auto.nfs with this content:

nas	-fstype=nfs,rw,intr,nolock

nas is the folder where the share will be mounted in /mnt. Adapt the nfs options to your needs. I added nolock because lock was not supported by my old NAS.

To activate all this setting:

sudo service autofs restart
using_autofs_to_mount_nfs_share_when_needed.txt · Last modified: 2013/03/05 21:59 by sgripon

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki