Assistanz
Assistanz

Auto mount filesystem using AutoFS

Auto mount filesystem using 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.

One drawback to using /etc/fstab is that, regardless of how infrequently a user accesses the NFS or any other 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.

Installation:

On Ubuntu/Debian

root@node-4:~# apt-get install autofs

On RHEL/CentOS

root@node-4:~# yum install autofs

Configuration:

Config files:

/etc/auto.master --> Master config file
/etc/auto.misc   --> Map file

Setup:

Create a directory  to mount AutoFS filesystems

root@node-4:~# mkdir /automnt

Add below entries In /etc/auto.master file

Syntax:

<mount point> <map file> <options>

root@node-4:~# cat /etc/auto.master
/automnt /etc/auto.misc --timeout=30

Here --timeout is optional.  The default timeout is 300 seconds and the file /etc/auto.misc is a default map file. You can also use  custom map file instead.

Now add below entries in /etc/auto.misc file.

Syntax:
<mount-point> [<options>] <location>

root@node-4:~# cat /etc/auto.misc
zaheer -fstype=nfs 192.168.2.45:/mynas

Here zaheer is mount point that will be mounted automatically.   192.168.2.45 is NFS server and 192.168.2.45:/mynas is location of the NFS export.

Now restart the autofs service to take effect the changes done.

root@node-4:~# service autofs restart

Testing Autofs:

root@node-4:~# cd /automnt/zaheer

Now check by executing df -h

root@node-4:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 283M 4.0K 283M 1% /dev
tmpfs 59M 292K 59M 1% /run
/dev/sda1 9.9G 1.5G 7.9G 16% /
none 100M 0 100M 0% /run/user
192.168.2.45:/mynas 9.8G 2.1G 7.2G 23% /automnt/zaheer

After 20 seconds of inactivity, it will be unmounted automatically.

Most Popular:

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.

DirectAdmin Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk
$ 99 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • NDA & SLA
  • SLA Review Meetings
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation
  •  

Platinum Support

24/7 Proactive Support
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Support

$ 30 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response Time
  • 4 Hours Resolution time for the Possible Issues
  • Security and Performance Optimization
  • React to Customers queries
  • Simple SignUp Process
  • Instant Account Activation
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support