You are not logged in.

#1 2011-01-04 02:55:55

colbert
Member
Registered: 2007-12-16
Posts: 809

Setting up AutoFS with NFS

I have NFS working on both server and desktop for ages, but would like to AutoFS so I don't have to manually mount/unmount constantly as well as with laptop. I followed here: https://wiki.archlinux.org/index.php/Au … ork_mounts  however I am confused by this:

Each host name needs to be resolveable, e.g. the name an IP address in /etc/hosts or via DNS and please make sure you have at least nfs-common installed and working. 

Well, I do have nfs-common working of course as well as nfs-server, problem is after this:

/net -hosts --timeout=60

to /etc/autofs/auto.master file as instructed at above link, I try to cd to /net/ and i only have /net/localhost.localdomain. I'm unclear on what to setup in /etc/hosts to mount my NFS shares from server with this. hmm

Thanks for any help!

edit: Just in case here is my /etc/autofs/auto.master:

# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(5).

/media/myth /etc/autofs/auto.media
/media/vantec /etc/autofs/auto.media
/media/cl-boblap /etc/autofs/auto.media
/media/cl-extra /etc/autofs/auto.media
/media/cl-windows /etc/autofs/auto.media

/net -hosts --timeout=60

(and I have extra line at end of file)

Last edited by colbert (2011-01-04 02:57:33)

Offline

#2 2011-01-04 07:17:20

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: Setting up AutoFS with NFS

I've been using the following since the beggining of time. No broken magic discovery.

auto.master
/var/autofs/net      /etc/autofs/auto.nfs  --timeout=60

auto.nfs
fatboy -fstype=nfs,rw,async,vers=3    192.168.0.101:/storage

rc.conf DAEMONS
nfs-common nfs-server

Last edited by anrxc (2011-01-04 07:21:34)


You need to install an RTFM interface.

Offline

#3 2011-01-05 01:40:29

colbert
Member
Registered: 2007-12-16
Posts: 809

Re: Setting up AutoFS with NFS

Ok, I did the above with the auto.nfs looking like this:

myth -fstype=nfs,rw,async,vers=3    192.168.1.100:/srv/nfs4/myth

I cd to /var/autofs/net/myth and it is there, great!! Couple things:

1. Now to be safe before I mess anything up, can I change /var/autofs/net to another location? Ideally I would like to have it at /media/myth instead.

2. The timeout is the timeout for how long it looks for the mount before abandoning an attempt? Can I change that to a shorter number?

3. Also, trying to setup with my laptop and adding entries isn't working in auto.nfs, it's not mounting them. I have added the bottom 3 lines:

myth -fstype=nfs,rw,async,vers=3    192.168.1.100:/srv/nfs4/myth
cl-boblap -fstype=nfs,rw,async,vers=3    192.168.1.105:/srv/nfs4/boblap
cl-extra -fstype=nfs,rw,async,vers=3    192.168.1.105:/srv/nfs4/compaq-extra
cl-windows -fstype=nfs,rw,async,vers=3    192.168.1.105:/srv/nfs4/compaq-windows

Thanks!

edit: Ack! I dunno what's going on now, I keep getting FAIL on /etc/rc.d/autofs restart, and there's no /usr/sbin/automount process but it's still displaying /var/autofs/net/myth! hmm
edit2: I manually killed (sudo kill -s 9) the /usr/sbin/automount process and now can't get autofs to restart. Enabled logging but nothing showing about it in /var/log/daemon.log...

Last edited by colbert (2011-01-05 05:53:21)

Offline

#4 2011-01-06 01:11:13

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: Setting up AutoFS with NFS

/var/autofs is the default, if you move it make sure to replicate any special permissions and ownership.
Do not restart the daemon while still in the mount. It will fail.
Sometimes if an initial mount fails for whatever reason  (let's say net was off) I found nothing else helps
but an autofs service restart. This started sometime this year. I was lazy to investigate.
To debug add maximum verbosity to /etc/conf.d/autofs or run automount daemon from command line in
foreground mode, with verbose output.
I use version 3, if you want to use NFS 4 remove vers=3 from mount options.

Last edited by anrxc (2011-01-06 01:12:28)


You need to install an RTFM interface.

Offline

#5 2011-01-09 22:30:02

colbert
Member
Registered: 2007-12-16
Posts: 809

Re: Setting up AutoFS with NFS

Okay I added verbosity to conf.d/autofs:

#localoptions='rsize=8192,wsize=8192'

# e.g. --timeout=60
daemonoptions='--verbose'

Here is my /etc/autofs/auto.master:

# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(5).

/var/autofs/net/      /etc/autofs/auto.nfs  --timeout=60

#/net -hosts --timeout=60

Here is /etc/autofs/auto.nfs:

cl-extra -fstype=nfs,rw,async    192.168.1.105:/srv/nfs4/compaq-extra

Here is relevant tail of /var/log/daemon.log:

Jan  9 17:05:43 localhost automount[20691]: attempting to mount entry /var/autofs/net/cl-extra
Jan  9 17:05:43 localhost rpc.idmapd[13356]: New client: 79
Jan  9 17:05:43 localhost rpc.idmapd[13356]: Opened /var/lib/nfs/rpc_pipefs/nfs/clnt79/idmap
Jan  9 17:05:43 localhost rpc.idmapd[13356]: New client: 7a
Jan  9 17:05:43 localhost rpc.idmapd[13356]: nss_getpwnam: name 'root@none' does not map into domain 'localdomain'
Jan  9 17:05:43 localhost rpc.idmapd[13356]: Stale client: 79
Jan  9 17:05:43 localhost rpc.idmapd[13356]:    -> closed /var/lib/nfs/rpc_pipefs/nfs/clnt79/idmap
Jan  9 17:05:43 localhost rpc.idmapd[13356]: Stale client: 7a
Jan  9 17:05:43 localhost rpc.idmapd[13356]:    -> closed /var/lib/nfs/rpc_pipefs/nfs/clnt7a/idmap
Jan  9 17:05:43 localhost automount[20691]: >> mount.nfs: Argument list too long
Jan  9 17:05:43 localhost automount[20691]: mount(nfs): nfs: mount failure 192.168.1.105:/srv/nfs4/compaq-extra on /var/autofs/net
Jan  9 17:05:43 localhost automount[20691]: failed to mount /var/autofs/net/cl-extra
Jan  9 17:05:43 localhost automount[20691]: attempting to mount entry /var/autofs/net/cl-extra
Jan  9 17:05:43 localhost automount[20691]: failed to mount /var/autofs/net/cl-extra
Jan  9 17:05:43 localhost automount[20691]: attempting to mount entry /var/autofs/net/cl-extra
Jan  9 17:05:43 localhost automount[20691]: failed to mount /var/autofs/net/cl-extra
Jan  9 17:05:43 localhost automount[20691]: attempting to mount entry /var/autofs/net/cl-extra
Jan  9 17:05:43 localhost automount[20691]: failed to mount /var/autofs/net/cl-extra

Not sure what's going on, I cd into /var/autofs/net/cl-extra and it says no dir exists of course. I do have NFS set up right on the laptop as I have been mounting laptop just fine for a long time. hmm

Offline

#6 2011-01-09 22:52:17

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: Setting up AutoFS with NFS

I have not switched to NFS4 yet. But I can see several potential problems. First something could be wrong with your /etc/idmapd.conf (because of "root@none does not map into..."). Also make sure to have NEED_IDMAPD="yes" in your /etc/conf.d/nfs-common.conf.

What is your exports file on the server? Does it export /srv/nfs4 ? Then do not attempt to mount the full path but server-ip:/cl-server. If your exports for this specific client are /srv/nfs4/compaq-extra then attempt to mount server-ip:/ Think of the export as a kind of a "chroot", with NFS4.


You need to install an RTFM interface.

Offline

#7 2011-01-09 23:43:44

colbert
Member
Registered: 2007-12-16
Posts: 809

Re: Setting up AutoFS with NFS

anrxc wrote:

I have not switched to NFS4 yet. But I can see several potential problems. First something could be wrong with your /etc/idmapd.conf (because of "root@none does not map into..."). Also make sure to have NEED_IDMAPD="yes" in your /etc/conf.d/nfs-common.conf.

Okay here is my /etc/idmapd.conf:

[General]

Verbosity = 1
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = localdomain

[Mapping]

Nobody-User = nobody
Nobody-Group = nobody

[Translation]

Method = nsswitch

And in my /etc/conf.d/nfs-common.conf for NEED_IDMAPD="" I had a blank, I just now put in "yes" for that line.

anrxc wrote:

What is your exports file on the server? Does it export /srv/nfs4 ? Then do not attempt to mount the full path but server-ip:/cl-server. If your exports for this specific client are /srv/nfs4/compaq-extra then attempt to mount server-ip:/ Think of the export as a kind of a "chroot", with NFS4.

Here is my exports from laptop that I want to mount from (101 is my desktop that I am trying to get to work with here in AutoFS):

/srv/nfs4 192.168.1.101(rw,fsid=0,no_subtree_check,async,no_root_squash)
/srv/nfs4 192.168.1.100(rw,fsid=0,no_subtree_check,async,no_root_squash)
/srv/nfs4/boblap 192.168.1.101(rw,no_subtree_check,async,nohide)
/srv/nfs4/boblap 192.168.1.100(rw,no_subtree_check,async,nohide)
/srv/nfs4/compaq-windows 192.168.1.101(rw,no_subtree_check,async,nohide)
/srv/nfs4/compaq-windows 192.168.1.100(rw,no_subtree_check,async,nohide)
/srv/nfs4/compaq-extra 192.168.1.101(rw,no_subtree_check,async,nohide)
/srv/nfs4/compaq-extra 192.168.1.100(rw,no_subtree_check,async,nohide)

I just changed the /etc/idmapd.conf NEED_IDMAPD="yes" line as well on laptop, now I have restarted nfs-common+nfs-server daemons on both, and restarted the autofs daemon on my desktop. I just cd'd into /var/autofs/net and it is indeed mounted! However, it is not mounting in /var/autofs/net/cl-extra, but instead at /var/autofs/net. Here is my /etc/autofs/auto.nfs at the moment adjusted to take out /srv/nfs4:

cl-extra -fstype=nfs,rw,async    192.168.1.105:/compaq-extra

Looks like almost there? Hehe.

EDIT: Okay so after rebooting both machines after kernel update, what happens on the desktop box is I cd into /var/autofs/net and it shows the dir "cl-extra", but cd'ing into that shows no such file or directory. Then I cd back into /var/autofs/net and immediately I see the contents of the mount and cl-extra is gone, it has worked but always shows in /var/autofs/net, not /var/autofs/net/cl-extra. I'm a bit confused-- it appears I have to cd into /var/autofs/net/cl-extra, then back into /var/autofs/net, every time to mount. Here is output from /var/log/daemon.log of relevance:

Jan 10 14:07:06 localhost automount[32016]: Starting automounter version 5.0.5, master map auto.master
Jan 10 14:07:06 localhost automount[32016]: using kernel protocol version 5.01
Jan 10 14:07:06 localhost automount[32016]: mounted indirect on /var/autofs/net/ with timeout 60, freq 15 seconds
Jan 10 14:07:06 localhost automount[32016]: ghosting enabled
Jan 10 14:07:33 localhost automount[32016]: attempting to mount entry /var/autofs/net/cl-extra
Jan 10 14:07:33 localhost rpc.idmapd[3327]: New client: 1
Jan 10 14:07:33 localhost rpc.idmapd[3327]: Opened /var/lib/nfs/rpc_pipefs/nfs/clnt1/idmap
Jan 10 14:07:33 localhost rpc.idmapd[3327]: New client: 2
Jan 10 14:07:33 localhost rpc.idmapd[3327]: nss_getpwnam: name 'root@none' does not map into domain 'localdomain'
Jan 10 14:07:33 localhost rpc.idmapd[3327]: New client: 3
Jan 10 14:07:33 localhost rpc.idmapd[3327]: Stale client: 2
Jan 10 14:07:33 localhost rpc.idmapd[3327]:     -> closed /var/lib/nfs/rpc_pipefs/nfs/clnt2/idmap
Jan 10 14:07:33 localhost automount[32016]: mount(nfs): mounted 192.168.1.105:/compaq-extra on /var/autofs/net
Jan 10 14:07:33 localhost automount[32016]: mounted /var/autofs/net/cl-extra

Thanks a ton for your all your help!!

Last edited by colbert (2011-01-10 20:34:45)

Offline

#8 2011-01-11 13:52:20

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: Setting up AutoFS with NFS

Seems like some of what I said got you in trouble. At least it's partially working now, you are much better off on Google to iron out these NFS4 quirks. Or another member with actual NFS4+autofs experience can help.


You need to install an RTFM interface.

Offline

#9 2011-01-12 03:08:11

colbert
Member
Registered: 2007-12-16
Posts: 809

Re: Setting up AutoFS with NFS

No worries mate I really appreciate the help, I'm trying some other forums, it's just so strange how it works perfect on the server to lap but not on the desktop. No biggie though there's always a way smile

Offline

#10 2011-01-24 23:55:45

colbert
Member
Registered: 2007-12-16
Posts: 809

Re: Setting up AutoFS with NFS

Just following up here, I wound up removing autofs completely (rm -r /etc/autofs and /etc/conf.d/autofs) and reinstalled, now it works just fine on all 3 boxes (server/desktop/laptop). Couple minor things I can't figure out:

1. If I set the mount point to /media in auto.master, then it mounts to /media, not /media/cl-extra. However, if I change it to /media/cl-extra in auto.master, it instead mounts to /media/cl-extra/cl-extra. It has no problem with /var/autofs/net, so to work around this I've left it at /var/autofs/net and just made a symlink in /media as I'm just very used to going to /media/mountpoint for all mounts over the years.

2. The only thing I can't figure out is, how do I change the timeout of it looking for the mount if the host is down? To be clear what I mean is: I'm browsing my laptop on the desktop shell, but then I shutdown laptop. Now on my desktop, cd'ing/ll'ing /var/autofs/net hangs forever. The --timeout line in the auto.master doesn't seem to apply to this. What I'd prefer is that if the host is down, then autofs just "gives up" after maybe 5 seconds or something and doesn't hang.

Offline

Board footer

Powered by FluxBB