NFS : Autofs : Automount Submount

Latest response

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

Have you tried using "ajcinfo ajgstorage1:/ajinfo" instead of "/ajcinfo ajgstorage1:/ajinfo" in /etc/auto.ajnfs?

Siem thank you for the suggestion, yes, I have tried it as well, however no success.

[root@r7ldnclient ~]# cat /etc/auto.ajnfs ajproj / $AJNFSSERV:$AJNFSPATH \ ajcinfo ajgstorage1:/ajinfo

[root@r7ldnclient ~]# systemctl status autofs ● autofs.service - Automounts filesystems on demand Loaded: loaded (/usr/lib/systemd/system/autofs.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2016-08-31 02:04:05 BST; 2s ago Process: 3157 ExecStart=/usr/sbin/automount $OPTIONS --pid-file /run/autofs.pid (code=exited, status=0/SUCCESS) Main PID: 3159 (automount) CGroup: /system.slice/autofs.service └─3159 /usr/sbin/automount -D AJNFSSERV=ajgstorage1 -D AJNFSPATH=/sbcimp --pid-file /run/autofs.pid

Aug 31 02:04:05 r7ldnclient.ajrhel7.net systemd[1]: Starting Automounts filesystems on demand... Aug 31 02:04:05 r7ldnclient.ajrhel7.net systemd[1]: Started Automounts filesystems on demand.

[root@r7ldnclient ~]# cd /ajnfs/ajproj/ajcinfo -bash: cd: /ajnfs/ajproj/ajcinfo: No such file or directory

[root@r7ldnclient ~]# cd /ajnfs/ajproj/ -bash: cd: /ajnfs/ajproj/: No such file or directory [root@r7ldnclient ~]#

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

Mike, thank you for your suggestion, this is how I got it fixed based on your suggestion but in a slightly different method, the way I wanted.

Below is my /etc/sysconfig/autofs config file

[root@r7ldnclient ~]# grep -v ^# /etc/sysconfig/autofs
USE_MISC_DEVICE="yes"
OPTIONS="-D AJNFSSERV=ajgstorage1 -D AJNFSPATH=/sbcimp"
[root@r7ldnclient ~]#

[root@r7ldnclient ~]# cat /etc/auto.master.d/ajnfs.autofs
/ajnfs  /etc/auto.ajnfs
[root@r7ldnclient ~]#

[root@r7ldnclient ~]# cat /etc/auto.ajnfs
ajproj / $AJNFSSERV:$AJNFSPATH \
/ajcinfo        ajgstorage2:/ajinfo
[root@r7ldnclient ~]#

Successfully mounted as below.

[root@r7ldnclient ~]# df -h /ajnfs/ajproj
Filesystem           Size  Used Avail Use% Mounted on
ajgstorage1:/sbcimp  2.2G  1.1G  1.1G  51% /ajnfs/ajproj
[root@r7ldnclient ~]# df -h /ajnfs/ajproj/ajcinfo
Filesystem           Size  Used Avail Use% Mounted on
ajgstorage2:/ajinfo  2.2G  1.1G  1.1G  50% /ajnfs/ajproj/ajcinfo
[root@r7ldnclient ~]#

Thank you all for your suggestion.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.