Mount NFS filesystems with autofs     (2024)

Posted: August 12, 2020 | | by Tyler Carrigan (Editorial Team, Red Hat)

Recently, I had the opportunity to learn how toconfigure NFS shares in Linux.During my exploration of NFS, I came across something that I thought was really interesting and I wantto share with Enable Sysadmin readers. What caught my attention is autofs. Let's dig into what autofs is and how it works.

Autofs defined

Autofs is an automount daemon that manages mount points as needed. In short, it only mounts a given share when that share is being accessed and are unmounted after a defined period of inactivity. Automounting NFS shares in this way conserves bandwidth and offers betterperformance compared to static mounts controlled by /etc/fstab.

How does it work?

Like most things in Linux, autofs uses a configuration file as the framework for completing tasks. It consults a map file located at /etc/auto.master. The file defines various mount points. Each entry in this file has three fields that need to be set for the daemon to work correctly. These fields are:

  1. Mount point
  2. Location of map file
  3. Optional field (allows for the inclusion of options)

Practical example

Let's look at how to mount a directory on our machines. For this demonstration, let's mount directory /afstest on our remote machine client.example.com (172.25.1.4) to the mount point /test/nfs_share. To do this, add the following to the auto.master file:

/test /etc/auto.misc --timeout 30

Once that is completed, add the following to our map file /etc/auto.misc:

autofstest -rw,soft,intr,rsize=8192,wsize=8192 client.example.com:/afstest

Field one in the auto.misc file is the name of the subdirectory in /misc. The second field contains our mount options, such as read and write permissions and size restrictions. The third field is the location of the NFS export.

NOTE: These fields are different from the fields listed in the /etc/auto.master

Once we have all of our options set, we need to restart the autofs service. Use the following command:

# /sbin/service autofs restart

Once complete, verify the active mount points by using this command:

# /sbin/service autofs status

As with all configuration file changes, if the service is running when the change is made, you need to reload the file. You can do this by restarting the service altogether or just doing a soft reload:

# /sbin/service autofs reload

Wrap up

The autofs utility is a great way to supplement your NFS journey with some additional insight into this useful feature. There is so much more to learn around the things we use every day if we just take the time to dig for it. Hopefully, you found this quick exercise helpful.

[ Free download: Advanced Linux commands cheat sheet. ]

Topics: Storage Linux

Mount NFS filesystems with autofs     (2024)
Top Articles
Audit Failure: Why it happens and how to prevent it
Can I deduct fees from buying and selling bitcoin on Coinbase?
My Arkansas Copa
Enrique Espinosa Melendez Obituary
Celebrity Extra
Did 9Anime Rebrand
oklahoma city for sale "new tulsa" - craigslist
How to change your Android phone's default Google account
Hk Jockey Club Result
10 Popular Hair Growth Products Made With Dermatologist-Approved Ingredients to Shop at Amazon
Dr Klabzuba Okc
Acts 16 Nkjv
Sportsman Warehouse Cda
The Pope's Exorcist Showtimes Near Cinemark Hollywood Movies 20
Embassy Suites Wisconsin Dells
Mlifeinsider Okta
Fallout 4 Pipboy Upgrades
Giovanna Ewbank Nua
Ukraine-Russia war: Latest updates
Seafood Bucket Cajun Style Seafood Restaurant in South Salt Lake - Restaurant menu and reviews
Bc Hyundai Tupelo Ms
10 Best Places to Go and Things to Know for a Trip to the Hickory M...
Grasons Estate Sales Tucson
Images of CGC-graded Comic Books Now Available Using the CGC Certification Verification Tool
Vistatech Quadcopter Drone With Camera Reviews
Odfl4Us Driver Login
Parentvue Clarkston
Sam's Club Gas Price Hilliard
Gs Dental Associates
Milwaukee Nickname Crossword Clue
Marilyn Seipt Obituary
Downtown Dispensary Promo Code
Log in or sign up to view
Experity Installer
Grays Anatomy Wiki
Σινεμά - Τι Ταινίες Παίζουν οι Κινηματογράφοι Σήμερα - Πρόγραμμα 2024 | iathens.gr
2008 Chevrolet Corvette for sale - Houston, TX - craigslist
Louisville Volleyball Team Leaks
Miracle Shoes Ff6
WorldAccount | Data Protection
Beaufort SC Mugshots
Nina Flowers
Charli D'amelio Bj
Uc Davis Tech Management Minor
Best Suv In 2010
Iman Fashion Clearance
Zom 100 Mbti
Leland Westerlund
60 Days From August 16
Greg Steube Height
Rétrospective 2023 : une année culturelle de renaissances et de mutations
Otter Bustr
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 6511

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.