Monday, May 14, 2012

autofs - auto mounting on Linux and Mac

I broke my head by working on weekend just to find out the way to do auto mounting of NFS file server on a Fedora and Mac book. Please follow the steps below to be head safe :P.

On Mac(10.6.8) -->

1. Open DirectoryAccess utility from  /System/Library/Core services/Directory Utility

2. select "BSD Flat File and NIS"

3. select edit

4. Domain name : mydomain.net
    Servers:  amt-admin1.mydomain.net
                  amt-admin2.mydomain.net

5.check "Use NIS domain for auth."

6. write following in /etc/auto_master

/homes auto.homes_amt  -resvport
/volume  auto.vols_amt  -resvport

7. restart autofs daemon as 
sudo launchctl stop com.apple.autofsd
sudo launchctl start com.apple.autofsd







On Linux (Fedora 13) -->



1. add "mydomain.net" in search row in /etc/resolv.conf file

it will look like -
====================================
[akashmahan@team lib]$ cat /etc/resolv.conf
# Generated by NetworkManager
domain mydomain.net
search domain.net  mydomain.net
nameserver 100.206.194.55
nameserver 100.209.194.55
====================================

2.  system --> administration -> authentication....
 Add your laptop to NIS domain

OR  modify /etc/yp.conf  to look like as --
======================================
[akashmahan@team lib]$ cat /etc/yp.conf
# generated by /sbin/dhclient-script
domain mydomain.net server 100.209.194.131
======================================

3. modify /etc/auto.master to look like
=====================================

[akashmahan@team lib]$ cat /etc/auto.master
/net    /etc/auto.net
/volume yp:auto.vols_amt       -intr,bg,tcp
/homes  yp:auto.homes_amt  -intr,bg,tcp

====================================

4. Restart ypbind and autofs as -
====================================
/etc/init.d/ypbind restart
/etc/init.d/autofs restart
====================================


Above procedures will mount the NFS server file system on your laptops. e.g my NFS file server /volume directory will be mounted on /volume directory of my laptop. If you do a "ls" in "/volume" directory on laptop, you will find nothing. You need to do a cd to specific directory then only that will be mounted.





No comments:

Post a Comment