LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 02-24-2016, 07:35 PM   #1
taea00
LQ Newbie
 
Registered: Feb 2016
Posts: 12

Rep: Reputation: Disabled
Can't Automount NFS


I have two systems. My "Server" and my "Client". I have set up NFS on the Server, I can see it on the client, I can manually mount it, I can even get it to mount properly in /net.

Code:
[root@client AUTOMOUNT_NFS]# showmount -e SERVER
Export list for SERVER:  
/nfs/first CLIENT

mount output
-hosts on /net/SERVER/nfs/first type autofs (rw,relatime,fd=13,pgrp=8950,timeout=300,minproto=5,maxproto=5,offset)

SERVER:/nfs/first on /net/SERVER/nfs/first type nfs4 (rw,nosuid,nodev,relatime,vers=4.0,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.148,local_lock=none,addr=192.168.122.60)

df output
SERVER:/nfs/first     18G  3.9G   14G  23% /net/SERVER/nfs/first

[root@client AUTOMOUNT_NFS]# ls /net/SERVER/nfs/first/
TEST  TEST2  TEST3  TEST4  TEST5

However, when I attempt to use /etc/auto.master and create /etc/auto.server_nfs with what I believe is the proper set up and then try to cd to the proper directory there is nothing in there. It doesn't mount properly. It shows when I run mount, but nothing is actually mounted. Here is my /etc/auto.master and /etc/auto.server_nfs. Can anyone please tell me what I'm doing wrong?


Code:
[root@client AUTOMOUNT_NFS]# cat /etc/auto.master
#
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(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


/mnt/SERVER_NFS	/etc/auto.server_nfs
#
# Include /etc/auto.master.d/*.autofs
# The included files must conform to the format of this file.
#
+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

[root@client AUTOMOUNT_NFS]# cat /etc/auto.server_nfs 
/mnt/SERVER_NFS	SERVER:/nfs/first

[root@client SERVER_NFS]# pwd
/mnt/SERVER_NFS

[root@client SERVER_NFS]# ls -l
total 0
I then cycled autofs with "systemctl restart autofs"

Any help is appreciated. Everything I've looked at suggests this should work. Most people will say in /etc/auto.server_nfs there should be an options field, but from what I've read there are defaults that applied and might not be necessary.


EDIT: I just added -fstype=nfs to the /etc/auto.server_nfs and mount will show it's mounting, but the directory shows nothing

Code:
mount:
SERVER:/nfs/first on /net/SERVER/nfs/first type nfs4 (rw,nosuid,nodev,relatime,vers=4.0,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=192.168.122.148,local_lock=none,addr=192.168.122.60)

[root@client SERVER_NFS]# pwd
/mnt/SERVER_NFS
[root@client SERVER_NFS]# ls -l
total 0

nothing listed under df.
When I attempt to unmount it I get an error that it's in use.
Code:
[root@client /]# umount /mnt/SERVER_NFS
umount: /mnt/SERVER_NFS: target is busy.
        (In some cases useful info about processes that use
         the device is found by lsof(8) or fuser(1))

[root@client /]# fuser /mnt/SERVER_NFS
/mnt/SERVER_NFS:      9681

[root@client /]# ps -ef | grep -i 9681
root      9681     1  0 19:44 ?        00:00:00 /usr/sbin/automount --pid-file /run/autofs.pid
root      9819  3686  0 19:48 pts/0    00:00:00 grep --color=auto -i 9681
EDIT: MadeInGermany had the answer. Thank you MadeInGermany!

Last edited by taea00; 02-26-2016 at 01:00 PM. Reason: Solved
 
Old 02-25-2016, 09:35 AM   #2
MadeInGermany
Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 255

Rep: Reputation: 101Reputation: 101
The mount point of the map, "/mnt/SERVER_NFS", is in auto.master. This is called an indirect map.
The keys in an indirect map must be relative, not starting with a /
Code:
# cat /etc/auto.server_nfs 
first	SERVER:/nfs/first
Then the key "first" appears as a subdirectory in the map mount point
Code:
cd /mnt/SERVER_NFS/first
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] nfs automount of exported filesystems empty on nfs server starfury6 Linux - Server 2 01-22-2014 09:08 AM
about NFS automount Safwan jamil Fedora 3 06-16-2010 12:12 AM
Help with NFS automount deathsfriend99 Linux - Server 2 07-01-2008 09:37 AM
automount nfs HA myutopia Linux - Networking 0 11-28-2006 12:06 PM
About NFS automount mahabooba Solaris / OpenSolaris 9 06-30-2006 01:31 AM


All times are GMT -5. The time now is 06:04 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration