Tuesday 22 September 2015

Autofs Configuration in RHEL 6


Autofs Configuration in RHEL 6

What is Autofs?


One drawback to using /etc/fstab is that, regardless of how infrequently a user accesses the NFS mounted file system, the system must dedicate resources to keep the mounted file system in place. This is not a problem with one or two mounts, but when the system is maintaining mounts to many systems at one time, overall system performance can be affected. An alternative to /etc/fstab is to use the kernel-based automount utility. An automounter consists of two components:
  • a kernel module that implements a file system, and
  • a user-space daemon that performs all of the other functions.

The automount utility can mount and unmount NFS file systems automatically (on-demand mounting), therefore saving system resources. It can be used to mount other file systems including AFS, SMBFS, CIFS, and local file systems.

Benefits of Autofs :-


  • Mounts occur automatically and transparently when a user tries to access any files or directories under the designated mount point of the remote file system to be mounted.
  • Mounts are removed automatically when the contents of the mounted file system have not been used for a specified period of time.
  • Users have transparent mount access; the mounts are automatically triggered when the user uses a command like cd to access files or directories that are actually on a remote file system. (In both conventional and automount methods, all user mounts must be preconfigured by the system administrator).
  • New links cannot be manually added and made active without rebooting automount.
  • One or more NFS servers may be designated as the source of a filesystem. This redundancy means that if one server is unavailable, the mount may be obtained from another.
  • Service primarily provided by the automount (NADM) command.
  • Files used are a variety of maps for configuring automatic mounts; /etc/mnttab for a listing of all the currently mounted file systems.

Autofs Daemon :-

  • autofs :- This daemon is used to performs all of the functions of Autofs

Important Files of Autofs :-

  • /etc/auto.master:- It’s a main configuration file of autofs. It contains the mount point and their mappings.
  • /etc/sysconfig/autofs:- Default startup directories.

Autofs Configuration LAB :-


Aufofs Practical Video :-


Autofs step by step configuration :-


Step 1:- Configure the NIC (Network Interface Card).
              Execute the following command to configure NIC.

              #setup

Step 2:- Restart the Network Service by executing the following command.

              #service network restart

Step 3:- Then check your NIC Configuration with the help of following command.

              # Ifconfig

Step 4:- In the next step we need to install autofs packages on our RHEL 6 machines. We can
              install it via “yum” (Red Hat Linux) and “apt-get” (Debian and Ubuntu) package installers.

              To install autofs packages using “yum” in RHEL 6 execute following command it: -

              # yum install autofs

              To install autofs packages using “apt-get” in Debian or Ubuntu execute following command it: -

              #apt-get install autofs

Step 5:- In this step you have to verify that autofs packages are installed.

              To verify the “autofs” package execute the following command:-

              #rpm –qa autofs

Step 6:- In the next step, create a new auto mount directory to mount the share on the Remote Host
              and named it whatever you want, you can also use an already existing directory with Autofs.

              To create a new directory executes the following command:-

              #mkdir /myshare

Step 7:- Execute the following command to display the share list of NFS Server.

              #showmount –e <server-ip-address >

              In our example, the server ip address is - 172.18.209.9.

              So the command will be looks like this:-

              #showmount –e 172.18.209.9

Step 8:- In the next step edit ‘/etc/auto.master’ file and add the map entry to it.

              The Syntax of map entry is shown below:-

              Mount_point   Map_name   Options

              Example:-

              /myshare    /etc/auto.myshare    --timeout=20

Step 9:- Now copy the map file “/etc/auto.misc” as “/etc/auto.myshare” else create it.

              To copy the map file “/etc/auto.misc” as “/etc/auto.myshare” use the following command:-

              #cp /etc/auto.misc /etc/auto.myshare

              Or to create a new map file, execute the following command:-

              #vim /etc/auto.myshare

Step 10:- In the next step add a mount point entry (also called map entry) to map file, which you have
              created in the previous step.

              The Syntax of map entry is shown below:-

              Mount_point    [options]    Location

              Example:-

              share1    -fstype=nfs    172.18.209.9:/nfsshare1

Step 11:- In the last step execute the following command to start, restart or reload the autofs daemon.

              To start the autofs daemon, execute the following command:-

              #service autofs start

              To restart the autofs daemon, execute the following command:-

              #service autofs restart

              To check the status of autofs daemon, execute the following command:-

              #service autofs status

              To reload the autofs daemon, execute the following command:-

              #service autofs reload

No comments:

Post a Comment