autofs unmout my /home drive

Latest response

Hi

I have different workstations each with its own /home drive and users on the machines.

Workstation_1 with user_a
Workstation_2 with user_b
Workstation_3 with user_c
...
 
On the Workstations I have the following set up, example Workstation_1
In my /etc/fstab I have the flowing entry to bind /nfsexports/user_a with /home/user_a

"/etc/fstab"
/home/user_a               /nfs4exports/user_a   none    rw,bind 0   0

The "/etc/exports" file looks like this.
/nfs4exports        *(rw,nohide,sync,insecure,root_squash,no_subtree_check)
/nfs4exports/user_a        *(rw,nohide,sync,insecure,root_squash,no_subtree_check)

The "/etc/auto.master" file looks like this.
/misc    /etc/auto.misc
/net    /etc/auto.net.nfs4
/home    /etc/users.master

The "/etc/users.master" file looks like this.
/usesr_b    -rw    Workstation_2:/nfs4exports/user_b
/usesr_c    -rw    Workstation_3:/nfs4exports/user_c

The "/etc/auto.net.nfs4" file looks like this.
opts="-fstype=nfs4,hard,intr,nodev,nosuid,nosymlink"
for P in /bin /sbin /usr/bin /usr/sbin
do
    for M in showmount kshowmount
    do
        if [ -x $P/$M ]
        then
            SMNT=$P/$M
            break
        fi
    done
done

[ -x $SMNT ] || exit 1
SHOWMOUNT="$SMNT --no-headers -e $key"

$SHOWMOUNT | LC_ALL=C sort -k 1 | \
    awk -v key="$key" -v opts="$opts" -- '
    BEGIN    { ORS=""; first=1 }
        { if (first) { print opts; first=0 }; print " \\\n\t" $1, key ":" $1 }
    END    { if (!first) print "\n"; else exit 1 }
    ' | sed 's/#/\\#/g'| sed -e 's,:/.[^\s]*,:/ ,'

When I start autofs the /home drive gets umounted and user_a doesn't have a home directory which is under "/home/users_a". I would appreciate it if someone can tell me what have I done wrong?

Responses