Sunday, February 1, 2015

Configure autohome using autofs

On server side

1. Export nfs share for the client
# cat /etc/exports
/opt/share                        *(rw,sync)
/opt/archive kuldeep(rw,sync)
/opt/archive ramsing(rw,sync)
[root@mohan share]# service nfs restart
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Shutting down RPC idmapd:                                  [  OK  ]
Starting NFS services:  exportfs: Failed to resolve kuldeep
exportfs: Failed to resolve kuldeep
                                                           [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting RPC idmapd:        

On client side

1. Install autofs package
# yum search autofs
# yum install autofs

2. Add entry to auto.master
# cat /etc/auto.master
/export/home    /etc/auto.users

3. Add/specify nfs share info
# cat /etc/auto.users
ram -rw 192.168.5.33:/opt/share/ram
# * -rw 192.168.5.33:/opt/share/&

4. Restart the autofs service
# service autofs restart

5. Verify if autofs is working
# cd /export/home/ram

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda2              18G  7.1G  9.5G  43% /
tmpfs                 495M  228K  495M   1% /dev/shm
/dev/sda1             283M   28M  240M  11% /boot
/dev/sr1              182M  182M     0 100% /media/CentOS
/dev/sr0              4.4G  4.4G     0 100% /media/CentOS_6.6_Final
192.168.5.33:/opt/share/ram
                       18G   13G  3.7G  79% /export/home/ram    ==>> this output confirms that autofs is working


No comments:

Post a Comment