Subscribe:

Ads 468x60px

Pages

Wednesday, April 20, 2011

Configuring AutoFS


Introduction:

Auto-mounts are mounted only as they are accessed, and are unmounted after a period of inactivity. Because of this, automounting NFS/Samba shares conserves bandwidth and offers better overall performance compared to static mounts via fstab.

Configuration Files:

The configuration is done with the help of 2 files.
  1. /etc/auto.master: It is a main configuration file. It holding the mount points.
  2. /etc/auto.nfs1:  It  is a mount point file providing the system options for this specific mount point.
  3. /etc/auto.misc: To find the mount options and the key associated to the file system. 

Installation:

Vertify whether autofs installed or not
root# rpm -qa autofs

if not installed then install it
root# yum install -y autofs*

Vertify installed version
root# rpm -qa autofs

View list of files releated to autofs
root# rpm -ql autofs

Configuring autofs:

Edit the /etc/auto.master file
root# cd /etc
root# vim /etc/auto.master
/nfs1  /etc/auto.share
+auto.master
Note: Local mount point nfs1 uses the /etc/auto.share config file

Edit the /etc/auto.shares for automount your remote host(1982.168.0.254)
root# vim /etc/auto.share
nfs1 –fstype=nfs 192.168.0.254:/share
Note: above step should follow the syntax as {mount point} {mount point} {location}

Create a directory /nfs1
root# mkdir /nfs1

Restart the autofs service
root# service autofs restart

Check the remote host’s files exists or not(it show empty directory)
root# ls –l /nfs1

But when access the directory with remote hosts directory. It will display all the content of the remote hosts.
root# cd /nfs1
root# ls –ltr share1

Check the service will run at boot time or not
root# chkconfig --list autofs
To start service at boot time:
root# chkconfig autofs on

Verify the service will run at boot time
root# chkconfig --list autofs

automount:

Automout works from an initial mount point (the one found by autofs to start automount) and from a new map describing the features of this initial mount point. The map associated to the automount will hold all required information for mounting the file system automatically (hence the name). This automatic mount is done as soon as someone tries to accesses something in the directory tree starting from the mount point. Next, the file systems are automatically "unmount" after an inactive period (the default time out is 5 minutes).

The default value of several general settings may be changed in the configuration file /etc/sysconfig/autofs.

To change the default time according to our wish then access the /etc/sysconfig/auto file then change the DEFAULT_TIMEOUT=300(default time set by system is 300 seconds i.e. 5 Minutes).

To change default time to 30 seconds
root# vim /etc/sysconfig/auto
DEFAULT_TIMEOUT=30
root# service autofs reload


0 comments:

Post a Comment