Wednesday, May 21, 2014

AutoFS in Linux

AutoFS automounts desired nfs share and other mountpoints automatically, when it is needed.

# yum install autofs
# /etc/init.d/autofs start
# chkconfig autofs on

Open the /etc/auto.master file to make your new entries for the automount. You will have one example in the file as cdrom.

# vim /etc/auto.master

/remote    /etc/auto.remote
:wq

Now create auto.remote file in the /etc/ directory

# vim /etc/auto.remote
nfs        -fstype=nfs,intr         192.168.122.50:/home/share
:wq

# /etc/init.d/autofs restart

# cd /remote/nfs
or
# ls /remote/nfs/

Now you should be able to access to the nfs from automount, if it becomes inactive for about 10 minutes, it will be disconnected automatically until you again access it. 

No comments:

Post a Comment