LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-17-2012, 01:52 PM   #1
rahilmaknojia
Member
 
Registered: Dec 2007
Distribution: RHEL6, CentOS6.3
Posts: 188

Rep: Reputation: 32
Autofs doesn't work


I have setup autofs to mount nfs automatically every I want to use it.

Here are the basic configurations I made in files:


[root@server2 /]# cat /etc/auto.master | grep -v ^#
/misc /etc/auto.misc
/shares /etc/auto.shares
/net -hosts
+auto.master

[root@server2 /]# cat /etc/auto.shares | grep -v ^#
nfs -fstype=nfs 192.168.122.1:/nfs

[root@server2 /]# cat /etc/sysconfig/autofs | grep -v ^#
TIMEOUT=300
BROWSE_MODE="no"
MOUNT_NFS_DEFAULT_PROTOCOL=4
USE_MISC_DEVICE="yes"


[root@server2 /]# ll /shares/
total 0
[root@server2 /]# ll /shares/
total 0
[root@server2 /]# ll /shares/
total 0
[root@server2 /]# ll /shares/
total 0
[root@server2 /]# ll /shares/
total 0

I did reboot the system, but it doesnt automatically mount on /shares directory, but if I manually mount nfs, it works!

[root@server2 /]# mount -t nfs 192.168.122.1:/nfs /shares/
[root@server2 /]# ll /shares/
total 0
-rw-r--r--. 1 root root 0 Sep 17 2012 selinux.txt

Any idea whats wrong with autofs?
 
Old 09-17-2012, 02:43 PM   #2
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
i am still semi new to autofs, but from what i have seen it will not auto mount on boot, that is what fstab is for. when you goto view the directory (mount points) autofs will mount the shares and you will have access to them.
 
Old 09-17-2012, 02:46 PM   #3
rahilmaknojia
Member
 
Registered: Dec 2007
Distribution: RHEL6, CentOS6.3
Posts: 188

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by lleb View Post
i am still semi new to autofs, but from what i have seen it will not auto mount on boot, that is what fstab is for. when you goto view the directory (mount points) autofs will mount the shares and you will have access to them.
Indeed you are right, but after accessing the shares directory, it doesn't automatically mount.
 
Old 09-17-2012, 03:05 PM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
ahh, now that would be a problem. i had to play with it on the cifs mounts i put in. let met post what i have for my cifs:

Code:
cat /etc/auto.master
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc	/etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
#	"nosuid" and "nodev" options unless the "suid" and "dev"
#	options are explicitly given.
#
/net	-hosts
#
# Include /etc/auto.master.d/*.autofs
#
+dir:/etc/auto.master.d
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
/mnt/newguyz	/etc/auto.newguyz	--timeout=600	--ghost
/mnt/techs	/etc/auto.techs		--timeout=600	--ghost


$ cat /etc/auto.newguyz
newguyz	-fstype=cifs,rw,noperm,username=XXXXXX,password=XXXXXXX	://10.10.0.73/NewGuyz



$ cat /etc/auto.techs
techs -fstype=cifs,rw,noperm,username=XXXXXXXX,password=XXXXXXXXXXXXX	://10.10.0.73/Techs
see if that helps any.
 
Old 09-17-2012, 04:09 PM   #5
rahilmaknojia
Member
 
Registered: Dec 2007
Distribution: RHEL6, CentOS6.3
Posts: 188

Original Poster
Rep: Reputation: 32
It didn't help much with

[root@server2 /]# cat /etc/auto.master | grep -v ^#
/misc /etc/auto.misc
/shares /etc/auto.shares --timeout=600 --ghost
/net -hosts
+auto.master
 
Old 09-17-2012, 09:06 PM   #6
rahilmaknojia
Member
 
Registered: Dec 2007
Distribution: RHEL6, CentOS6.3
Posts: 188

Original Poster
Rep: Reputation: 32
Doesn't anyone know how to fix the issue?
 
Old 09-17-2012, 09:13 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
autofs can use lazy mounting ( -hosts) ; this means it only actually mounts the share when you access the content eg cd into it.
https://access.redhat.com/knowledge/...ig-autofs.html
 
Old 09-17-2012, 09:35 PM   #8
rahilmaknojia
Member
 
Registered: Dec 2007
Distribution: RHEL6, CentOS6.3
Posts: 188

Original Poster
Rep: Reputation: 32
Smile

Quote:
Originally Posted by chrism01 View Post
autofs can use lazy mounting ( -hosts) ; this means it only actually mounts the share when you access the content eg cd into it.
https://access.redhat.com/knowledge/...ig-autofs.html
Right, but when I ls into the directory I provided mount_point in auto.master file, it doesn't mount when I cd or ls into the directory I created for auto mount.

Here is the different linux box I tried on:

[root@rhel6 ~]# cat /etc/auto.master | grep -v ^#
/misc /etc/auto.misc
/net -hosts
+auto.master
/shares /etc/auto.shares

[root@rhel6 ~]# cat /etc/auto.shares | grep -v ^#
nfs -fstype=nfs 172.16.1.23:/nfs

[root@rhel6 ~]# cat /etc/sysconfig/autofs | grep -v ^#
TIMEOUT=300
BROWSE_MODE="no"
MOUNT_NFS_DEFAULT_PROTOCOL=4
USE_MISC_DEVICE="yes"

FIREWALL>>>>>>>>>>>>>>

[root@rhel6 ~]# cat /etc/sysconfig/iptables | grep -v ^#
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5900:5905 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

I hope this gives you more details.
 
Old 09-18-2012, 01:17 AM   #9
rahilmaknojia
Member
 
Registered: Dec 2007
Distribution: RHEL6, CentOS6.3
Posts: 188

Original Poster
Rep: Reputation: 32
Okay here is the deal and I tell you whats going on after playing wit different system all day.

I have CentOS6.3 box running with two KVM known as server2 and tester1. I have one more box, but that has RHEL6.1. So when I use autofs in RHEL box, it works! Only trouble I had was that I wasn't doing cd nfs inside shares folder. When I did "cd nfs" it automatically mounted nfs drive in rhel box.

Now, on KVM's. SO as I said KVM's are running on Centos6.3 box. NFS server is running on main box (CentOS6.3) and I am trying to run autofs on server2, but I cannot get it to mount. Both are on same network with 192.168.122.0/24. Both can ping each other, but when I configure autofs and try to use the mount_point, but doesn't work.

Here is what happens:

[root@server2 /]# cd share/
[root@server2 share]# cd nfs
-bash: cd: nfs: No such file or directory
[root@server2 share]#
 
Old 09-18-2012, 01:25 PM   #10
rahilmaknojia
Member
 
Registered: Dec 2007
Distribution: RHEL6, CentOS6.3
Posts: 188

Original Poster
Rep: Reputation: 32
Here is the log from messages

Sep 17 04:02:55 server2 automount[1800]: lookup_read_master: lookup(nisplus): couldn't locate nis+ table auto.master
Sep 17 04:03:11 server2 automount[1800]: key "-" not found in map source(s).
Sep 17 04:05:22 server2 automount[1800]: umount_autofs_indirect: ask umount returned busy /share
Sep 17 04:05:26 server2 automount[1865]: lookup_read_master: lookup(nisplus): couldn't locate nis+ table auto.master
Sep 17 04:05:31 server2 automount[1865]: key "-" not found in map source(s).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofs doesn't mount directories Aramsh Linux - Networking 16 02-13-2011 01:28 PM
Autofs mounts, but doesn't umount Linux.tar.gz Slackware 5 04-27-2010 07:13 AM
autofs doesn't mount my CD rwcooper Linux From Scratch 3 07-12-2007 07:44 PM
autofs do not work vjhuntz Linux - General 11 06-27-2007 10:26 PM
autofs in sid doesn't work! Skyblaze Debian 2 02-27-2005 12:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration