Вы находитесь на странице: 1из 10

What is Autofs

• Autofs is used to automatically mount any filesystem on


demand as and when you access them and not only it will
mount automatically but it can automatically unmount any
filesystem when not in used for a particular predefined
timeout value.

Why should I use Autofs
? I understand a question which generally pops up in
people's mind that even putting nfs share entry in
/etc/fstab makes it auto mountable so how does it differs
from autofs? Well as I defined above autofs is not only/at
all about mounting the share on every reboot.

 Take a scenario where a nfs share is supposed to be


mounted at boot but it is not accessibe due to some
reasons which will lead to delayed startup or even there
might be a case when your OS will not at all boot up.
Advantages of AutoFS
 Shares are accessed automatically and transparently when
a user tries to access any files or directories under the
designated mount point of the remote filesystem to be
mounted.
 Booting time is significantly reduced because no mounting
is done at boot time.
 Network access and efficiency are improved by reducing
the number of permanently active mount points.
 Failed mount requests can be reduced by designating
alternate servers as the source of a filesystem.
configuration steps for autofs using NFS
share
• we have two servers namely nfsserver and nfsclient. Lets start
configuring a NFS share on nfsserver

• On NFS Server:
• /work nfsclient(ro)
/myraid nfsclient(ro)

 These are two simple shares which I am sharing with nfsclient


 Restart the nfs services or reload the shares
• # exportfs –r
• The above command reexport all directories, synchronizing
/var/lib/nfs/etab with /etc/exports.

• To see all the shares and the applied permissions


• # exportfs -v
/work 192.168.1.12(ro,wdelay,root_squash,no_subtree_check)
/myraid 192.168.1.12(ro,wdelay,root_squash,no_subtree_check)
On nfsclient
/etc/auto.master
, also referred to as the master map. The master map lists autofs-
controlled mount points on the system, and their corresponding
configuration files or network sources known as automount maps.

# vi /etc/auto.master
(Create a new line in between and add as shown below)
/mnt /etc/auto.misc --timeout=20

The general format :


mount-point [options] location
edit auto.misc file
• # vi /etc/auto.misc
Add a new line in the last as shown below
deepak -fstype=nfs 192.168.1.11:/work
raid -fstype=nfs 192.168.1.11:/myriad

• Its time to reload our autofs services

Verify if autofs is running



# /etc/init.d/autofs status
automount (pid 5362) is running...
Make sure the NFS shares are not already mounted

# df –h
cd /mnt/Deepak
ls
output: deep myfile.txt

As you see the files under "deepak" share on NFS server are
accessible from the nfsclient just by doing "cd" to the
share
You can use the watch command to verify if the shares
automatically gets unmounted.

# watch mount
THANK YOU

Вам также может понравиться