Sample Header Ad - 728x90

autofs mount local directory when nfs unavailable

0 votes
2 answers
1047 views
I want to have my home directory be an NFS mount when it's available, or a local directory when it's not. Think of a laptop that I might want to take somewhere off of my normal network. What I have today is an automount map that mounts an NFS share on my home. I've been poking around stack exchange and it suggests coda https://unix.stackexchange.com/questions/17216/keep-local-copy-of-nfs-mount-on-computer However it's a really old project and I'm not seeing it in the apt repository leading me to believe this is probably not going to work well. What I've tried to do is automount nfs home directories into /nethome like this:
bash
/etc/auto.nethome * -fstype=nfs4,rw,sec=sys,soft,rsize=8192,wsize=8192,no_root_squash h2gt2g.deepthot.aa:/volume1/homes/&

mkdir -p /nethome/me

/etc/fstab:  /home/me /nethome/me none defaults,bind 0,0
Sadly this doesn't work at all. Either it ends up with the bind or nothing working at all. I'm thinking I can't do something this simple minded. Has anyone else succeeded at doing something like this? It seems like this would be something people would do. As a side note, I've had nfs automounted home directories on all my machines/vms for 20 or so years. I've been wanting to do something similar to what I just described almost as long, but have never had any luck with it.
Asked by denebeim (3 rep)
Apr 16, 2021, 12:09 AM
Last activity: Apr 17, 2021, 05:38 PM