is it possible to mount hostname specific nfs share in /etc/fstab

Posted on

Problem :

I want to mount a hostname specific nfs Filesystem in /etc/fstab.

10.0.0.1:/testmy/<hostname> /nfs_for_host

if there any Variable to do this ?

Solution :

Try to add the following to your /etc/fstab :

10.0.0.1:/testmy/<hostname>  /nfs_for_host nfs _netdev,defaults,user,auto,noatime,intr   0 0

Explanation of the options (from man 8 mount and man 5 nfs):

  • _netdev: The filesystem resides on a device that requires network access.
  • defaults: Use default options: rw, suid, dev, exec, auto, nouser, async, and relatime.
  • user: Allow an ordinary user to mount the filesystem .
  • auto: Can be mounted with the -a option.
  • noatime: Access timestamps are not updated when a file is read.
  • intr: Allow signals to interrupt file operations on this mount point.

I don’t think you can do it in fstab, but you can use NIS and automount to accomplish the same thing.

See this:
http://www.timgalyean.com/2010/03/automounting-home-directories-with-nis-and-nfs/

Leave a Reply

Your email address will not be published. Required fields are marked *