I have an NFS problem on a Redhat Ent Linux 5 host, in that I want to mount some NFS shares on /opt/backup and /opt/stage.

There are also some other dirs and files in /opt e.g. /opt/myapp, /opt/otherapp, /opt/test, etc which we want to access while the NFS shares are mounted.

Currently the NFS shares mounted on boot from /etc/fstab and all works well.

However we want to mount /opt/backup and /opt/stage on demand via autofs/automounter instead of on boot from /etc/fstab.

I have this configured such that the NFS shares mount OK with autofs/automounter but when the automounter mount the NFS shares on the mount points I can not see the other files in /opt.

Is it possible to use the automounter to mount the NFS shares on /opt/backup and /opt/stage and still be able to access the other files in /opt, ie. /opt/myapp, /opt/otherapp, /opt/test etc?

If so how?

I have run a demo session which has been pasted it in below with some comments to try and help explain the problem.


Here's the demo:

# /opt has the two mount point dirs "backup" and "stage" as well as the dirs "lost+found" # "myapp" "otherapp" and the file "test"

[root@jttest6 etc]# ls /opt
backup  lost+found  myapp  otherapp  stage  test

# We list the NFS mountpoints - there are no files, the NFS shares are not # mounted (Autofsd is not running at this point)

[root@jttest6 etc]# ls /opt/backup
[root@jttest6 etc]# ls /opt/stage

# This is what is in /etc/auto.master

[root@jttest6 etc]# grep -v ^# /etc/auto.master
/misc   /etc/auto.misc

/opt            /etc/auto.opt
/net    -hosts

# This is what is in /etc/auto.opt

[root@jttest6 etc]# cat /etc/auto.opt
backup          -rw,soft,intr,rsize=8192,wsize=8192     nfs.icesa.catholic.edu.au:/opt/backup
stage           -

rw,soft,intr,rsize=8192,wsize=8192 nfs.icesa.catholic.edu.au:/opt/stage

# we start autofs

[root@jttest6 etc]# service autofs start
Starting automount:  

                                  [  OK  ]

# we list the NFS mountpoints (I pipe into head because the listings are long - this # is sufficient to show that something is now mounted there)

[root@jttest6 etc]# ls /opt/backup|head -2
[root@jttest6 etc]# ls /opt/stage|head -2

# However we have now lost access to the dirs "lost+found" "myapp" "otherapp" and the file "test"

[root@jttest6 etc]# ls /opt
backup  stage

This is an indirect mount setup and it sounds like you want a direct mount point setup. Try:

/- /etc/auto.opt

/opt/backup          -rw,soft,intr,rsize=8192,wsize=8192     nfs.icesa.catholic.edu.au:/opt/backup

Source: http://docs.oracle.com/cd/E19455-01/806-0916/rfsrefer-72/index.html

| improve this answer | |
  • Thanks Preston I'm not in a position to test this until next week, but I'll get back to you. – Jason Tan Sep 27 '12 at 5:44
  • Glad to have helped! – Preston Oct 3 '12 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.