NFS : Autofs : Automount Submount
I have 2 NFS export, I need to do a submount, i.e 2nd NFS automount on top of 1st NFS automount
Below is NFS Server export
[root@c7gluster1 ~]# exportfs -v
/ajinfo 192.168.7.0/24(rw,wdelay,root_squash,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
/sbcimp 192.168.7.0/24(rw,wdelay,root_squash,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
On the Client Autofs configuration is as below am using the /etc/sysconfig/autofs to do the base mount
[root@r7ldnclient ~]# tail -1 /etc/sysconfig/autofs
OPTIONS="-D AJNFSSERV=ajgstorage1 -D AJNFSPATH=/sbcimp"
[root@r7ldnclient ~]# cat /etc/auto.master.d/ajnfs.autofs
/ajnfs /etc/auto.ajnfs
[root@r7ldnclient ~]# cat /etc/auto.ajnfs
ajproj / $AJNFSSERV:$AJNFSPATH \
/ajcinfo ajgstorage1:/ajinfo
[root@r7ldnclient ~]#
[root@r7ldnclient ajproj]# pwd
/ajnfs/ajproj
[root@r7ldnclient ajproj]# df -h /ajnfs/ajproj
Filesystem Size Used Avail Use% Mounted on
ajgstorage1:/sbcimp 2.2G 1.1G 1.1G 51% /ajnfs/ajproj
[root@r7ldnclient ajproj]#
But if I access the submount I get below error, why am I not able to mount "ajgstorage1:/ajinfo" on mount point /ajnfs/ajproj/ajcinfo note I have already mounted OPTIONS="-D AJNFSSERV=ajgstorage1 -D AJNFSPATH=/sbcimp" on mount point /ajnfs/ajproj
root@r7ldnclient ajproj]# cd ajcinfo
-bash: cd: ajcinfo: No such file or directory
Please advise.
Responses
So, first thing is you are using an indirect map for /ajnfs.
[root@r7ldnclient ~]# cat /etc/auto.master.d/ajnfs.autofs
/ajnfs /etc/auto.ajnfs
So, with this type of map, you really only have the option of specifying the second-level of the path (i.e. the one after /ajnfs).
If you want /ajnfs/ajproj to be mounted from one NFS location, and then you want /ajnfs/ajproj/ajcinfo mounted from another direction, you should be using a direct map which will allow you to have the structure you are looking for.
You would want something like this:
# cat /etc/auto.master.d/ajnfs.autofs
/- /etc/auto.ajnfs
# cat /etc/auto.ajnfs
/ajnfs/ajproj $AJNFSSERV:$AJNFSPATH
/ajnfs/ajproj/ajcinfo ajgstorage1:/ajinfo
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
