0

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.

Thanks.

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
+auto.master

# 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
ACL
brocade-backups
[root@jttest6 etc]# ls /opt/stage|head -2
ADF
ApplicationServer101202

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

[root@jttest6 etc]# ls /opt
backup  stage
Jason Tan
  • 2,752
  • 2
  • 17
  • 24

1 Answers1

1

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

/etc/auto.master
/- /etc/auto.opt

/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

Preston
  • 289
  • 1
  • 5