Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm struggling to get automount to work as desired.

If I run the following:

sudo mount -t nfs server:/path/to/share /path/to/mount_point

I get the mount appearing fine.

However, if I add the following line to my auto_master:

/path/to/mount_point server:/path/to/share

it creates the mount point directory but the contents aren't visible.

When I observe the output of the mount command, they are different:

  • Using the first (manual mount) approach the following entry is returned by mount:

    server:/path/to/share on /path/to/mount_point (nfs)
    
  • Using automount I get the following entry returned by mount:

    map server:/path/to/share on /path/to/mount_point (autofs, automounted, nobrowse)
    

I assumed that by default, automount mounts via NFS and is equivalent to the manual mount.

What is the correct way to use automount to acheive the behaviour of the (correctly working) manual mount?

The share is hosted on a Linux NIS domain and I am accessing from a Mac (BSD Unix).

share

1 Answer 1

up vote 3 down vote accepted

The /etc/auto.master file is not the place to set the remote NFS directory path. /etc/auto.master expects to be given a map file or directory. From the auto.master man page:

The auto.master map is consulted to set up automount managed mount points when the autofs(8) script is invoked or the automount(8) program is run. Each line describes a mount point and refers to an autofs map describing file systems to be mounted under the mount point.

So, create a file called /etc/auto.remote (you can change "remote" to whatever you want). Place your mount options in that file. It should have the following format:

share_name  mount_options  server:/remote/path/to/share

Here's one from my system for example:

movies  -rw,soft,intr,bg,rsize=8192,wsize=8192 192.168.0.72:/nfs_shares/movies

You can then reference the auto.remote file from your auto.master:

/path/to/mount_point   /etc/auto.remote --timeout 60 --ghost
share
    
Thank you for this answer—it worked! Out of interest could you provide some intuition on why those options you set are good practise or useful? I went with just the mount point and share path. –  CraftyThumber Sep 26 '12 at 15:12
    
I adapted them from somewhere or other. The most important one for me is the soft option that make sure the daemon will not wait indefintely, causing the system to hang, when the remote server is unavailable. –  terdon Sep 26 '12 at 15:39
    
What about direct automounts? Have they gone completely? –  Nils Sep 26 '12 at 19:42
    
What do you mean @Nils? The drive will be mounted as soon as you try to access it (ls for example). –  terdon Sep 27 '12 at 11:11
    
I refer to direct automounts. But there is a little hint in man auto.master: format is a subset of the sun automounter format - the same seems to be true for Linux auto.master: In Solaris you CAN define such a mount directly in auto.master without the use of an indirect map. –  Nils Sep 27 '12 at 20:36

This site is currently not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .