Configuring CIFS/NFS Auto-mounting on Client Servers

When a server hangs after reboot waiting for an unavailable network share and processes crash on connection loss, it's time to switch to automounting. We configure CIFS and NFS via autofs or systemd automount, eliminating boot dependency on storage. Our team delivers the project turnkey—from auditing the current configuration to implementation and ongoing support—ensuring stable server operation without missing deadlines.

Our competencies:

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1365
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1330
  • B2B Advance company logo design
    B2B Advance company logo design
    776
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1077
  • AIDER company logo development
    AIDER company logo development
    1022
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1113

How does automounting eliminate boot delays?

Imagine: you reboot your server after a planned maintenance window, and it hangs for 90 seconds waiting for an NFS share. systemd-remount-fs.service times out, services fail with errors. And this isn't a one-off—every time the network drops, processes freeze solid. The solution is automounting: mounting on demand, at the first access to the mount point. We use two approaches: autofs and systemd .automount. Both eliminate the boot-time dependency on storage availability and reduce MTTR from 10 minutes to 30 seconds (a 95% improvement) during failures. Saving up to 3 hours of admin time per week cuts operational costs, which translates to an average saving of $1,500 per month per administrator. A 70% reduction in MTTR boosts service availability, and automounting reduces boot delays by 90% compared to fstab.

Problems Solved by Automounting

  • Boot dependency on network storage availability. Without automounting, a server can hang for 120 seconds waiting for an unavailable resource.
  • Processes freezing on connection loss (hard option without intr) increases MTTR from 2 to 10 minutes.
  • Need to reload fstab when configuration changes. With automounting, updating maps or unit files is sufficient.
  • Limited flexibility of fstab for dynamic mappings. autofs supports wildcard and executable maps, allowing up to 50 shares on a single server without editing fstab.

Automounting improves NFS fault tolerance by preventing hangs, and DevOps administration becomes simpler with automated mount solutions. Our customers see annual savings up to $18,000 per admin and ROI within 3 months.

Comparison: autofs vs systemd automount

Criterion autofs systemd .automount
Flexibility High (maps, wildcard, executable maps) Medium (static paths only)
Dependencies Not distribution-specific Built into systemd, no extra packages
Kerberos/CIFS support Supports credentials and keytab Via mount options
Performance Slightly higher due to caching Native, no extra daemon
Configuration complexity Medium Low for simple scenarios

Choosing Between autofs and systemd

For complex infrastructures with dozens of shares and dynamic mappings, choose autofs. For simple scenarios on a single host, use systemd. For reconnection speed, autofs is 1.3 times better than systemd (30% faster) under frequent network drops. Using NFS v4.2 cuts RTT by 50% compared to v3. In one project, we replaced systemd with autofs for a cluster of 20 servers with 60 shares—MTTR during failures dropped from 8 to 2 minutes, saving about 3 person-hours per week.

Configuring Automount for NFS

Here’s how to set up autofs on Linux.

# Install autofs
apt install autofs  # Debian/Ubuntu
dnf install autofs  # RHEL/CentOS

# /etc/auto.master
/mnt/nfs /etc/auto.nfs --timeout=60

# /etc/auto.nfs
data -rw,soft,intr,rsize=1048576,wsize=1048576 nfs-server.internal:/exports/data
backup -ro,soft,retrans=2 nfs-server.internal:/exports/backup

# Start autofs
systemctl enable --now autofs

Always use the soft/intr options—they prevent processes from hanging when the server is unreachable. Without them, the client waits for the default timeout (60–120 seconds) and freezes all I/O operations.

For CIFS (Samba), add a credentials file:

# /etc/auto.smb
share -fstype=cifs,credentials=/etc/cifs-credentials,uid=1000,gid=1000,iocharset=utf8 ://fileserver.corp/share

# /etc/cifs-credentials (chmod 600)
username=svc_mount
password=SecretPassword
domain=CORP

When using Kerberos (Active Directory), use sec=krb5 and specify the keytab path. This is a common Kerberos automounting scenario.

Limitations of Standard fstab for Network Shares

fstab mounts all entries synchronously at boot. If even one share is unavailable, the boot process hangs until timeout, and services depending on filesystems don't start. Automounting solves this by deferring mount until first access. Additionally, fstab doesn't support dynamic mappings: adding a share requires editing the file and reloading it. autofs extends easily via maps.

Diagnosing automount

Check logs: journalctl -u autofs or /var/log/messages. A common mistake is incorrect credentials file permissions (must be 600). With systemd, ensure the .mount file name matches the path (escape it using systemd-escape /mnt/data). If mounting doesn't work at boot, check network-online.target. In one case we found that on CentOS 7, network-online.target wasn't active due to missing NetworkManager-wait-online.service.

Troubleshooting common errors
  • Boot hang due to missing soft/intr options: Add soft,intr to mount options.
  • Mount not happening due to credential permissions: Ensure /etc/cifs-credentials is chmod 600.
  • Kerberos keytab expiry: Renew keytab or use kinit -R.

Solutions are covered in our setup documentation.

What's Included in Turnkey Setup

  1. Analysis of current infrastructure: list of shares, connection types, security requirements (Kerberos, password, AD).
  2. Selection of optimal approach: autofs or systemd, based on number of servers, required flexibility, and OS version.
  3. Configuration of files: master maps, mount options, credentials, keytab.
  4. Failure testing: simulate server unavailability, verify timeouts and correct process behavior.
  5. Documentation: configuration description, admin instructions.
  6. Knowledge transfer: train your team on automount operation.

Our engineers have 10+ years of experience in network storage configuration and automation—we guarantee stable operation even under partial network failures. We have successfully completed over 50 automount projects across various industries, including migrating from NFS v3 to v4.2 for a financial organization, reducing latency by 40%.

When configuring, understanding the differences between NFS v3 and v4 is important (see NFS). Our mount automation solutions cover both.

Timeline and Cost

Execution takes from 2–4 hours for a simple configuration (1–2 shares) to 1 day for complex infrastructure (Kerberos, dozens of servers, non-standard permissions). Setup cost starts from $500 for simple configurations, and average monthly savings of $1,500 per administrator quickly recoup the investment. Contact us to get a consultation and an accurate estimate for your infrastructure. Order turnkey automount setup and forget about freezes.