PDA

View Full Version : Problem configuring autofs



xgadlga
25-Nov-2013, 14:49
Hi folks,

Im going to switch over to autofs instead of fstab entries, but Im having problems...

Note: All VMs are running on SLES11SP2.

I have several mounts to be palced unter /opt, but there are also a lot of local folders which have to stay there.
So, as I read in the manuals, I must use direct mounts to keep the local directories under /opt .

So, Im testing under /mnt on my testing vm.

That is, what I configured:
glitst02:~ # cat /etc/auto.master | grep -v \#
/- /etc/auto.etis --timeo=1 --ghost
+auto.master

glitst02:~ # cat /etc/auto.etis | grep -v \#
/mnt/common -fstype=nfs4,ro,soft,bg,intr,suid,dev,exec,auto,nou ser,async,retrans=1,retry=0 glitst01:/opt/common

But when I go to /mnt/common, nothing is in the folder, but it is NOT mounted

/var/log/messages output:
Nov 25 13:36:12 glitst02 automount[3439]: mounted direct on /mnt/common with timeout 600, freq 150 seconds
Nov 25 13:36:12 glitst02 automount[3439]: file map /etc/-fstype=nfs4,ro,soft,bg,intr,suid,dev,exec,auto,nou ser,async,retrans=1,retry=0 not found
Nov 25 13:36:12 glitst02 automount[3439]: lookup(yp): read of map /mnt/common failed: Request arguments bad
Nov 25 13:36:12 glitst02 automount[3439]: mounted indirect on /mnt/common with timeout 600, freq 150 seconds
Nov 25 13:36:12 glitst02 automount[3439]: ghosting enabled

Has anybody an idea what I am doing wrong?

Thanks a lot!

bye
Lars

mikewillis
25-Nov-2013, 23:35
Has anybody an idea what I am doing wrong?

Apart from using cat to pipe files to grep? ;)


$ grep -v ^# /etc/auto.master
You've posted in the SLED forum, The SLES forums are at https://forums.suse.com/forumdisplay.php?8-SUSE-Linux-Enterprise-Server but autofs is common to both, so no worries.

But as to your autofs problem, is this:


glitst02:~ # cat /etc/auto.master | grep -v \#
/- /etc/auto.etis --timeo=1 --ghost
+auto.master

glitst02:~ # cat /etc/auto.etis | grep -v \#
/mnt/common -fstype=nfs4,ro,soft,bg,intr,suid,dev,exec,auto,no user,async,retrans=1,retry=0 glitst01:/opt/common

The result of copy/paste or you typing it all out? There shouldn't be a space in 'no user'. (I've actually added a space in there in my post. In your post it shows has having a space, when I copy/paste it to a text editor there's a space, but when I quote the text the forum software seems to remove the space. Which is interesting.) Also I'm pretty certain 'timeo' isn't a valid option and if it's supposed to be 'timeout' then setting it to 1 seems overly enthusiastic, possibly problematically so. I once tracked a weird issue I was seeing to my having specified a timeout value that was quite short.

That said, I've tried what you've posted removing the erroneous space and changing the name of the server to one local to me which has an nfs4 mount on, and it works:


linux-7xyj:~ # grep -v ^# /etc/auto.master
/- /etc/auto.etis --timeo=1 --ghost
+auto.master
linux-7xyj:~ # grep -v ^# /etc/auto.etis
/mnt/common -fstype=nfs4,ro,soft,bg,intr,suid,dev,exec,auto,nou ser,async,retrans=1,retry=0 xxx.xxx.xxx.xxx.xxx:/apps
linux-7xyj:~ # ls /mnt
boo common foo yoo
linux-7xyj:~ # mount | grep 'mnt/common'
linux-7xyj:~ # ls /mnt/common/ > /dev/null
linux-7xyj:~ # mount | grep 'mnt/common'
xxx.xxx.xxx.xxx.xxx:/apps on /mnt/common type nfs4 (ro,timeo=1,soft,intr,retrans=1,retry=0,sloppy,add r=nnn.nnn.nnn.nnn,clientaddr=nnn.nnn.nnn.nnn)
linux-7xyj:~ #
This is on SLED 11 SP3 mind you, I do not have any machines running SLES 11 SP2. I have SLES 11 SP3 but not accessible to play with right now.

Unless there's some significant difference between autofs on SLED 11 SP3 and SLES 11 SP2 all I can think off hand is to check your files for erroneous spaces and such. If you're not using NIS for autofs maps I'd comment out the '+auto.master' line in /etc/auto.master, though it doesn't seem to prevent it working, at least not on my machine.

I've never actually done direct mounting. I have a set up where I need to have something mounted at / and I can't have the contents of that controlled by autofs, just like you can't have the contents of /opt so controlled. Rather than use direct mounting I use a symbolic link instead.

:~> file /apps
/apps: symbolic link to `/mnt/auto/apps'
:~> grep -v ^# /etc/auto.master
/home yp auto.home rsize=32768,wsize=32768,nosuid,noatime
/mnt/auto /etc/auto.apps
:~> grep -v ^# /etc/auto.apps
apps -fstype=nfs4 -ro -nosuid -tcp xxx.xxx.xxx.xxx.xxx:/apps
:~>

I set it up about five years ago and can't remember why I used a symbolic link, but if you can't get it working with direct mounting you could try using indirect and symbolic links.

When posting output of commands or contents of files it's best to wrap it in CODE tags because it makes it clear where the output starts and ends and can also help avoid formatting issues. Look for the # button when composing the post. E.g.


$ date
Mon 25 Nov 22:15:50 GMT 2013

xgadlga
26-Nov-2013, 11:55
Hi, thanks a lot for you reply...


Of course, you are right, but I did a cat on the files before and then I just pasted the | grep... from another console because Im lazy...
[QUOTE=mikewillis;17688]Apart from using cat to pipe files to grep? ;)


$ grep -v ^# /etc/auto.master



Concerning the spaces, this seems to be a copy/past issue. In the config file, there a no spaces in between.
That was verified, of course.

I took another VM to test it and now it works! I dont know what is the problem on the VMs where I tested...

So, it seems to be fixed...

Here is the working config:



/etc/auto.master Content:

/- /etc/auto.etis --ghost --timeout=10


/etc/auto.etis Content:
/opt/tst03 -fstype=nfs4,rw,soft,bg,intr,suid,dev,exec,auto,nou ser,async,retrans=1,retry=0 <host>:/opt/common




You mentioned another point, concerning timeouts, perhaps you have a "best practices" for me?
As you mentioned my szenario is "server-like" but it also might be interesting for SLES Desktop Users...

The target szenario is, that I have to mount approx. 20 NFS-Shares (from 15 different Servers) to /opt/WebSphere, on a server.
It can happen that one of the VMs is down (reboot etc...) and I want the automounter to give up Mounting very soon. (less then 30s will be ok I think)
When the server is available again, the share should be accessible again.

What ind of timeouts should I configure to which values?

Thanks a lot in advance.

kind regards
Lars

mikewillis
26-Nov-2013, 14:00
I was revealing my ignorance with my previous comment about timeo being a valid value, it is, I just hadn't heard of it and couldn't find references to it yesterday, it's not in mount or mount.nfs man pages, though I have found references to it online today. I did establish yesterday that putting nonsense options in the auto.master didn't stop things working though. I tried this in /etc/auto.master

/- /etc/auto.etis --timeo=1 --ghost --garbage
+auto.master
and things still worked. timeo is a valid option when mounting nfs

# mount -t nfs4 -o ro,nosuid,tcp,timeo=5 xxxxxxxxxxxx:/apps /mnt/foo/
# umount /mnt/foo/
# mount -t nfs4 -o ro,nosuid,tcp,timeo=5,erhgrehg xxxxxxxxxxxx:/apps /mnt/foo/
mount.nfs4: an incorrect mount option was specified

Anyway, the timeout I was referring to as having problems with was the timeout value for autofs, as in the number of seconds autofs waits before unmounting an unused mount. I've looked through the old versions of configuration I use and I was setting the timeout to 60 seconds. I was seeing an intermittent problem with an application running from a volume that was mounted with autofs with a 60 second timeout. sadly I don't seem to have a record of everything I went through to identify the problem, but I do have a note which says the problem went away when I stopped specifying 60 seconds and let autofs use the default, which is 600. So unless there's a specific reason to change the autofs timeout I'd be inclined to leave it alone.