Article 5EWSC Using autofs with rbind/nested mounts

Using autofs with rbind/nested mounts

by
kaiserkarl13
from LinuxQuestions.org on (#5EWSC)
[This post was also cross-posted on fedoraforum.org several months ago here, but as of posting there were no replies, so I thought I'd run it by this forum as well.]

TL;DR: How do you instruct autofs to use recursive bind rather than simple bind for local mounts?

Skip to the bottom for the question; everything before the last line is information to provide context.

I have a setup in which users' home directories are auto-mounted; the gist of it is that
Code:/home/[hostname]/[username]resolves to [username]'s home directory whether the user is logged in on the machine on which that directory is stored or not. Say a user named frank has a home directory that is on a machine called "athens"; then his home directory is
Code:/home/athens/frankbut his files are actually stored at
Code:/homedirs/frankon the host "athens." This map is set up by the files /etc/auto.master.d/homedirs.autofs, which looks like this:
Code:/home /etc/auto.master.d/auto.homeand another file called /etc/auto.master.d/auto.home, which looks like this (for example):
Code: athens :/homedirs
sparta -fstype=nfs sparta:/homedirsSimilarly, host sparta contains the same homedirs.autofs, but its auto.home looks like this:
Code: athens -fstype=nfs athens:/homedirs
sparta :/homedirsThis works great under ordinary circumstances, assuming that both athens and sparta have /etc/exports set up as something like this:
Code:/homedirs 192.168.1.0/24(rw,no_root_squash,async)or whatever the subnet address block is. However, if there is another directory under frank's home directory, say, "/homedirs/frank/extra_space," then this extra directory is only visible from sparta, not athens. The exportfs looks like this:
Code: /homedirs 192.168.1.0/24(rw,no_root_squash,async)
/homedirs/frank/extra_space 192.168.1.0/24(rw,no_root_squash,async)Here's the tricky part: on sparta, I can do
Code:ls /home/athens/frank/extra_spaceand I see the contents of extra_space, as I should. This works through NFS, because the files are on athens, not on sparta. On athens itself, however, I would do
Code:ls /home/athens/frank/extra_spaceand I would see an empty directory.

The issue is equivalent to doing something like
Code:mount -o bind /homedirs/athens /home/athensrather than
Code:mount -o rbind /homedirs/athens /home/athensHow do I get autofs to use recursive bind mounts for the directories it mounts locally?latest?d=yIl2AUoC8zA latest?i=R7us-wKKHaQ:RmnnWN1rRH4:F7zBnMy latest?i=R7us-wKKHaQ:RmnnWN1rRH4:V_sGLiP latest?d=qj6IDK7rITs latest?i=R7us-wKKHaQ:RmnnWN1rRH4:gIN9vFwR7us-wKKHaQ
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments