Whenever you’re using NFS mount points, it’s really nice to use some type of automounter. Linux and FreeBSD use AMD to accomplish this, but Solaris uses automountd, and it’s fun and easy to use… Here is an example of a configuration that will automatically mount an NFS share and unmount it after 5 minuets of inactivity.
We have a system called micky which has an NFS point shared to a system called minny as /shareme.
We can see that it is set up in the /etc/dfs/dfstab file on micky:
share -F nfs -o ro=minny.yourdomain.com -d “NFS ShareMe” /shareme
The above will share the directory read-only. If you would like to map the directory as root and be able to write to it, the command would look more like this:
share -F nfs -o rw,root=minny.yourdomain.com -d “NFS ShareMe” /shareme
You can run the share command on micky to check to make sure it is shared:
– /shareme ro=minny.yourdomain.com “NFS ShareMe”
If it’s not shared, run shareall to share it:
Now, jump on over to minny and add the following line to /etc/auto_master:
Automountd will now look in /etc/auto_direct for direct mount points.
Next edit /etc/auto_direct and add the following line:
Now, create the directory for the NFS mount point on minny:
# mkdir /micky-shareme
Finally, run the auromount command on minny to inform the daemon of the changes:
That should do it… Have fun with your new automount NFS share.
More information on this can be found here