I've been trying to read up on this for the EX200 exam and haven't been able to make sense of it. Can someone explain the difference to me in an indirect/direct NFS mount?
Here's a link to the video I use for my classes on this topic. This is for the RH134 class, chapter 9 (which my college calls CIS238RH).
autofs, with direct, indirect, and indirect "wildcard" (my term) mounts, begins at 37:48
[Please be kind... I had pneumonia when I recorded the video, so there times when I make some noises, like snuffling and coughing. Also, my videos are unedited; I leave my mistakes in them so students can see that (1) no one is perfect and (2) how to recover from a mistake.]
https://www.youtube.com/watch?v=gNYGQ5cqkm0
The difference in their creation is only in how you identify the mount point in the master map file and the mapping file.
Direct Mount:
Master Map File is always /-
Mapping file contains the complete path to the mount point using absolute syntax.
Indirect Mount:
Master Map File: /<first portion of mount>
Mapping File contains the rest of the mount point or a wildcard using relative syntax
What happens when the autofs service starts or restarts is that it looks in the Master Map File (/etc/auto.master and all included files *.autofs) is that the autofs service creates the first portion of the mounts. So in indirect mounts we see the portion from the Master Map File - but in the Direct mount my description is that it bounces off the /- and into the Mapping file and it creates all the directories defined for the mount point in the Mapping file.
Direct Master Map:
/- /etc/auto.direct
Direct Mapping File:
/demo -rw,sync serverx:/myshare1
/xfiles/shares -rw,sync serverx:/myshare2
So when autofs starts it will create the /demo, /xfiles, and /xfiles/shares directories
Indirect Master Map:
/indy /etc/auto.indirect
Indirect Mapping File:
stuff -rw,sync serverx:/myshare3
items -rw,sync serverx:/myshare4
When autofs starts it only creates the /indy directory. Not /indy/stuff or /indy/items!
This changes the behavior in the following five ways:
1- Direct Mounts can have local files that were in the directory before the mount happened show up as well as the mounted shares, indirect mounts block access to local stored files as long as the mount is active.
2-Direct Mounts allow autocompletion (tab completion) for all directories, indirect only allows it for the created directory.
3-After autofs runs it creates an entry in the /etc/mtab (mount table) file for each mount autofs is watching. For the above example it would add two lines to the direct mount but only one line to the indirect mount. Now consider that if you have hundreds of mount points using direct mounts would bloat this file (which is constantly being refreshed - try running tail -f /etc/mtab). imagine the extra load on the system having hundred of more lines in this file - it can degrade performance. Indirect mounts keep the /etc/mtab file leaner.
4-Indirect Mounts you can make changes to the Mapping file without having to restart autofs - as long as the mount is not currently active.
5-Indirect Mounts thus can use wildcards. If you had a wildcard with a direct mount it would have to produce an infinite number of directories when autofs bounces off /- and into the mapping file.
Here's a link to the video I use for my classes on this topic. This is for the RH134 class, chapter 9 (which my college calls CIS238RH).
autofs, with direct, indirect, and indirect "wildcard" (my term) mounts, begins at 37:48
[Please be kind... I had pneumonia when I recorded the video, so there times when I make some noises, like snuffling and coughing. Also, my videos are unedited; I leave my mistakes in them so students can see that (1) no one is perfect and (2) how to recover from a mistake.]
https://www.youtube.com/watch?v=gNYGQ5cqkm0
Thanks @Tracy_Baker for the video ! Video is just perfect for a learner !
The difference in their creation is only in how you identify the mount point in the master map file and the mapping file.
Direct Mount:
Master Map File is always /-
Mapping file contains the complete path to the mount point using absolute syntax.
Indirect Mount:
Master Map File: /<first portion of mount>
Mapping File contains the rest of the mount point or a wildcard using relative syntax
What happens when the autofs service starts or restarts is that it looks in the Master Map File (/etc/auto.master and all included files *.autofs) is that the autofs service creates the first portion of the mounts. So in indirect mounts we see the portion from the Master Map File - but in the Direct mount my description is that it bounces off the /- and into the Mapping file and it creates all the directories defined for the mount point in the Mapping file.
Direct Master Map:
/- /etc/auto.direct
Direct Mapping File:
/demo -rw,sync serverx:/myshare1
/xfiles/shares -rw,sync serverx:/myshare2
So when autofs starts it will create the /demo, /xfiles, and /xfiles/shares directories
Indirect Master Map:
/indy /etc/auto.indirect
Indirect Mapping File:
stuff -rw,sync serverx:/myshare3
items -rw,sync serverx:/myshare4
When autofs starts it only creates the /indy directory. Not /indy/stuff or /indy/items!
This changes the behavior in the following five ways:
1- Direct Mounts can have local files that were in the directory before the mount happened show up as well as the mounted shares, indirect mounts block access to local stored files as long as the mount is active.
2-Direct Mounts allow autocompletion (tab completion) for all directories, indirect only allows it for the created directory.
3-After autofs runs it creates an entry in the /etc/mtab (mount table) file for each mount autofs is watching. For the above example it would add two lines to the direct mount but only one line to the indirect mount. Now consider that if you have hundreds of mount points using direct mounts would bloat this file (which is constantly being refreshed - try running tail -f /etc/mtab). imagine the extra load on the system having hundred of more lines in this file - it can degrade performance. Indirect mounts keep the /etc/mtab file leaner.
4-Indirect Mounts you can make changes to the Mapping file without having to restart autofs - as long as the mount is not currently active.
5-Indirect Mounts thus can use wildcards. If you had a wildcard with a direct mount it would have to produce an infinite number of directories when autofs bounces off /- and into the mapping file.
@Jeff_Henderson The summary is succint and concise !
I realize this discussion is a year old now, but I wanted to thank Jeff Henderson for the very clear and sustinct explanaition. About to re-certify after a 6 years, and I suspect many of us never use this autofs in our day to day (At least I never have).
Agree
I appreciate you recognizing Jeff Henderson's useful explanation even a year later. It's encouraging to know that his guidance remains relevant as you get ready for your certification renewal.
If autofs isn't frequently used in daily tasks, it's still beneficial to review these concepts for a wider understanding and skill enhancement.
@CommanderRiker Thanks for your input here. In my previous job role as a system admin - we frequently used to encounter stale file error in NFS mounts. For example LDAP user home directories - we resolved the same using automount tool. It is used in many organisations - that I know and is a very helpful technology.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.