How to mount NFS using automounter(autofs)?

 
Thread Tools Search this Thread
Operating Systems Linux Red Hat How to mount NFS using automounter(autofs)?
# 1  
Old 05-02-2013
RedHat How to mount NFS using automounter(autofs)?

I have an nfs at 192.168.1.10:/home/vm1/Desktop/nfs and will like to mount locally to /home/vm1/Desktop/nfs-mount using automounter...need help doing do

What i did


$cat /etc/auto.master
Code:
/home/vm1/Desktop    /etc/auto.nfs

$cat /etc/auto.nfs
Code:
nfs-bind     -fstype=nfs    192.168.1.34:/home/vm1/Desktop/nfs

And yes autofs is running and is reloaded

Code:
[root@vm1 ~]# service autofs status
automount (pid  3534) is running...
[root@vm1 ~]# service autofs reload
Reloading maps

Is that the correct way to do that? If yes then why is it that its not working...nothing got mounted..nothing
# 2  
Old 05-02-2013
You have specified an indirect map auto.nfs, mounted on /home/vm1/Desktop.
Code:
df /home/vm1/Desktop

will tell it's controlled by automount.
The key in auto.nfs is nfs-bind, so you will find the actual mount
Code:
cd /home/vm1/Desktop/nfs-bind
df .

If the NFS server denies the mount (no NFS share access) it should be syslogged to /var/log/messages.
But some autofs5 versions don't log it (but log other things that do not make sense at all). So, as root, test it with a manual mount:
Code:
mkdir -p /mnt
mount 192.168.1.34:/home/vm1/Desktop/nfs /mnt
umount /mnt

# 3  
Old 05-02-2013
Quote:
Originally Posted by MadeInGermany
You have specified an indirect map auto.nfs, mounted on /home/vm1/Desktop.
Code:
df /home/vm1/Desktop

will tell it's controlled by automount.
The key in auto.nfs is nfs-bind, so you will find the actual mount
Code:
cd /home/vm1/Desktop/nfs-bind
df .

Code:
[root@vm1 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_sda2-lv_root
                      6.5G  3.5G  2.7G  57% /
tmpfs                 940M  236K  940M   1% /dev/shm
/dev/sda1             485M   64M  396M  14% /boot
/dev/sr0               57M   57M     0 100% /media/VBOXADDITIONS_4.2.12_84980
df: `/home/vm1/Desktop/nfs-mount': No such file or directory
[root@vm1 ~]# df /home/vm1/Desktop
Filesystem           1K-blocks      Used Available Use% Mounted on
-                            0         0         0   -  /home/vm1/Desktop

Quote:
If the NFS server denies the mount (no NFS share access) it should be syslogged to /var/log/messages.
But some autofs5 versions don't log it (but log other things that do not make sense at all). So, as root, test it with a manual mount:
Code:
[root@vm1 ~]# cat /var/log/messages | tail
May  2 03:13:10 vm1 kernel: Registering the id_resolver key type
May  2 03:13:10 vm1 kernel: FS-Cache: Netfs 'nfs' registered for caching
May  2 03:13:10 vm1 rpc.mountd[1703]: authenticated mount request from 192.168.1.34:756 for /home/vm1/Desktop/nfs (/home/vm1/Desktop/nfs)
May  2 03:15:12 vm1 yum[2994]: Installed: 1:telnet-0.17-47.el6_3.1.x86_64
May  2 03:15:55 vm1 kernel: RPC: fragment too large: 0x7ff4fffd
May  2 03:29:55 vm1 automount[3534]: lookup_read_master: lookup(nisplus): couldn't locate nis+ table auto.master
May  2 03:29:59 vm1 automount[3534]: lookup_read_master: lookup(nisplus): couldn't locate nis+ table auto.master
May  2 03:48:48 vm1 automount[3534]: lookup_read_master: lookup(nisplus): couldn't locate nis+ table auto.master
May  2 05:05:03 vm1 automount[3534]: key "nfs-mount" not found in map source(s).
May  2 05:07:15 vm1 automount[3534]: key "nfs" not found in map source(s).


Quote:
Code:
mkdir -p /mnt
mount 192.168.1.34:/home/vm1/Desktop/nfs /mnt
umount /mnt

Code:
[root@vm1 ~]# mount 192.168.1.34:/home/vm1/Desktop/nfs /mnt
mount.nfs: access denied by server while mounting 192.168.1.34:/home/vm1/Desktop/nfs

---------- Post updated at 05:20 AM ---------- Previous update was at 05:16 AM ----------

Quote:
Originally Posted by MadeInGermany
You have specified an indirect map auto.nfs, mounted on /home/vm1/Desktop.
Code:
df /home/vm1/Desktop

will tell it's controlled by automount.
The key in auto.nfs is nfs-bind, so you will find the actual mount
Code:
cd /home/vm1/Desktop/nfs-bind
df .

If the NFS server denies the mount (no NFS share access) it should be syslogged to /var/log/messages.
But some autofs5 versions don't log it (but log other things that do not make sense at all). So, as root, test it with a manual mount:
Code:
mkdir -p /mnt
mount 192.168.1.34:/home/vm1/Desktop/nfs /mnt
umount /mnt

Just noticed something strange

Code:
[root@vm1 ~]# cd /home/vm1/Desktop/nfs-bind
-bash: cd: /home/vm1/Desktop/nfs-bind: No such file or directory
[root@vm1 ~]# ls -lh /home/vm1/Desktop
total 0

I cannot list the files and folders under /home/vm1/Desktop anymore..what is going on here? Something went wrong and can't figure it out...i think this is probably the same reason i was finding it hard to mount nfs and samba/cifs as well


Another strange thing...i restarted the system and i lost all folders and files created under /home/vm1/Desktop..Desktop is not back to default like fresh install...what is going on here? Before i restarted i could see the folders and files on the desktop even though i got the error that directory does not exist (from above) but now after restart...the desktop is back to default...all folders created before are gone/disappeared

---------- Post updated at 09:00 AM ---------- Previous update was at 05:20 AM ----------

I cannot mkdir as root
please see below

Code:
[root@vm1 ~]# mkdir /home/vm1/Desktop/nfs
mkdir: cannot create directory `/home/vm1/Desktop/nfs': Permission denied

so i checked the selinux context below and got

Code:
[root@vm1 ~]# ls -Z /home/vm1
drwxrwxrwx. root root system_u:object_r:autofs_t:s0    Desktop
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Documents
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Downloads
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:audio_home_t:s0 Music
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Pictures
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Public
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Templates
drwxr-xr-x. vm1  vm1  unconfined_u:object_r:user_home_t:s0 Videos


Can someone tell me what is wrong here?
And yes i was trying to mount nfs using autofs at some point and wasn't running so seeing autofs there is confusing me..maybe it caused a problem somewhere...


also after the autofs problem i noticed the whole folders and files in /home/vm1/Desktop are all gone.

Please what happened?

Thanks

Last edited by Scrutinizer; 05-05-2013 at 02:22 PM.. Reason: changed icode tags to code tags
# 4  
Old 05-05-2013
Quote:
Code:
root@vm1 ~]# mount 192.168.1.34:/home/vm1/Desktop/nfs /mnt
mount.nfs: access denied by server while mounting 192.168.1.34:/home

Check on the NFS server 192.168.1.34 why it denies NFS client vm1 access to the NFS share.
I am a bit confused, because you seem to have two mounts:
Code:
/home/vm1/nfs-mount 192.168.1.10:/home/vm1/Desktop/nfs
/home/vm1/nfs-bind  192.168.1.34:/home/vm1/Desktop/nfs

Then, vm1 seems to be both NFS client and NFS server?
Maybe somebody else is less confused?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

RHEL 7.1 autofs permissions do not match NFS servers

RHEL 7.1 client using autofs to mount a NIS map of home directories being exported by a Solaris 10x86 nfs server. The owner and group are correct on the NFS server, but on the RHEL client, the owner and group end up being nobody nobody. The USERS and GROUPS are NIS maps as well. They are... (2 Replies)
Discussion started by: mrmurdock
2 Replies

2. Shell Programming and Scripting

Mount NFS Share On NFS Client via bash script.

I need a help of good people with effective bash script to mount nfs shared, By the way I did the searches, since i haven't found that someone wrote a script like this in the past, I'm sure it will serve more people. The scenario as follow: An NFS Client with Daily CRON , running bash script... (4 Replies)
Discussion started by: Brian.t
4 Replies

3. Solaris

Autofs not mount

Hi all, Please help! After my solaris 10 is rebooted, I found my autofs seems not mounting the file systems. I restart autofs service : #svcadm -v restart svc:/system/filesystem/autofs:default Action restart set for svc:/system/filesystem/autofs:default. But still... (1 Reply)
Discussion started by: Zaiwen Gong
1 Replies

4. Red Hat

NFS, AD, AutoFS

Here's my challenge. I have a RedHat7 machine running a statistical software package. It needs to NFS-mount directories from a Windows 2008R2 machine. The RH7 machine uses MSAD (Microsoft Active Directory) to handle authentication of people connecting via SSH. AD is on a separate 2008R2 machine.... (5 Replies)
Discussion started by: cjhilinski
5 Replies

5. UNIX for Dummies Questions & Answers

NFS issue with autofs in CentOS 6.3

I am running CentOS 6.3 as a VM on a host which has the same installation. I configured my NFS server and I am guessing it works. I say guessing because I can mount the desired folder with mount command on my client machine. So, when I run: mount -t nfs -o vers=3 vm2.domain.com:/nethome /nethit... (7 Replies)
Discussion started by: bashily
7 Replies

6. UNIX for Advanced & Expert Users

Autofs, doesn't mount anything

Hi, I know that this is probably quite a tiresome issue, but I can't get autofs to work. I'm using udev rules to create symbolic links below /dev, that always point to the same devices regardless of which port they're plugged in. So, autofs's config files look like this for me: ... (0 Replies)
Discussion started by: Gunther
0 Replies

7. Solaris

autofs vs nfs

I've a sun server, 3 sun workstations and plan to do backup on certain directory in each workstations monthly. As it's only require to mount as NFS on those workstations once a month. So I plan to configure such requirement using autofs. What are the considerations need to take care in such... (4 Replies)
Discussion started by: KhawHL
4 Replies

8. UNIX for Advanced & Expert Users

solaris 10 autofs - how to mount /net (hosts)

Hello Everyone, I am working with Solaris 10 autofs feature. On the server (and client) in /etc/auto_master I have this entry: /net -hosts -nosuid,nobrowse On the server, I have shared out /var/tmp, started the nfs server and issued the shareall command. When I issue share I can... (1 Reply)
Discussion started by: anies rahman
1 Replies

9. UNIX for Dummies Questions & Answers

mount -o llock -F nfs vs mount -F nfs

Hi, We encountered NFS issue (solaris) especially running on Oracle application. Problem such as forms hang when close button is click, concurrent job shows running status all time. Understand we need to use mount -o llock -F nfs instead of mount -F nfs to eliminate? this problem.. Can... (1 Reply)
Discussion started by: KhawHL
1 Replies

10. Solaris

disabling nfs and autofs in solaris 9

Hi, I want to permanently disable nfs and autofs in solaris 9, (2 Replies)
Discussion started by: manoj.solaris
2 Replies
Login or Register to Ask a Question