Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

DevOpsCheetah

Ho me Linux Clo ud  Pr o g r a mming  Mo nit o r ing  CI/CD  Ca t eg o r ies 

AUTOFS
 June 2, 2021  Atul Rajput  0 Comment

AutoFS is a utility that mount local or remote drives only when they are accessed
and if you don’t use them, they will be unmounted automatically after a certain
time (as configured).

Difference Between /etc/fstab and Autofs


(AutoMount)
As we know that /etc/fstab is used for permanent mounting of file systems but it
has advantage only if you have limited mount points connected to your
/etc/fstab file but if you are working on a large organisation and have so many
mount points linked to your /etc/fstab file then in that case your overall system’s
performance  gets effected.

But Autofs mounts the file systems on user’s demand. By default, the mount point
configured in Autofs is in unmounted state till the user access the mount point,
We use cookies on our website to give you the most relevant experience by remembering your preferences
andonce
repeat visits.
user tryByto
clicking
access“Accept All”, you consent
the mount point it to the
will use of automatically
mount ALL the cookies. However, you may visit
and if user Cookie Settings Accept All
"Cookie Settings" to provide a controlled consent.
don’t use the mount point for some time then it will automatically go to
unmounted state.

How to Configure AUTOFS in RHEL


Machine
Prerequisites
You should have sudo permissions as a user
autofs package should be installed on your machine

Configuration Files used in Autofs


/etc/auto.master
/etc/auto.misc  (name of this file can be anything)
/etc/sysconfig/autofs

Steps for configuring Autofs :


In our example we will mount the NFS share using autofs. NFS share ‘/db_backup‘
is exported from NFS Server (192.168.1.21). We are going to mount this nfs share on
CentOS 7 machine

1 : Edit the Master map file (/etc/auto.master)

[root@devopscheetah ~]# cat /etc/auto.master | grep -v “#”


/dbstuff /etc/auto.nfsdb –timeout=180
/dbstuff should be a directory on your client system.
NFS Share will automatically umount after 180 seconds or 3 minutes if user
doesn’t access the share.
/etc/auto.nfsdb is our MAP File where we will configure the NFS server and Mount
details.

2 : Configure map file ‘/etc/auto.nfsdb’

[root@devopscheetah ~]# cat /etc/auto.nfsdb


db_backup -fstype=nfs,rw,soft,intr 192.168.1.21:/db_backup

db_backup is a directory where ‘192.168.1.21:/db_backup’ is mounted.


-fstype=nfs is the file system type & ‘rw,soft,intr’ are mount options.
‘192.168.1.21:/db_backup’ is nfs share location.

3 : Start the auotfs service

[root@devopscheetah ~]# systemctl start autofs.service


[root@devopscheetah ~]# systemctl enable autofs.service

4 : Now try to access the mount point

Mount point of nfs share will be ‘/dbstuff/db_backup’. When we try access the
mount point then autofs service will mount nfs share automatically and the
content of db_backup directory will be accessible.
 

Check out : How we can creat e VPC/Subnet s on AWS ?

T ags: AutoFS , Autofs in RHEL

Leave a Reply
Your email address will not be published. Required fields are marked *

Comment

Name *
Email *

Websit e

Save my name, email, and websit e in t his browser for t he next t ime I comment .

POST COMMENT

 Previous Post Next Post 

Related Posts

Blogs About Us Contact Us Privacy Policy   


© 2021. DevOpsCheetah.com

PDFmyURL.com - convert URLs, web pages or even full websites to PDF online. Easy API for developers!

You might also like