Situation
When mounting network filesystems like NFS or CIFS, a common race condition occurs: the system attempts to mount the share before the network stack is fully online. Furthermore, if the remote server is unreachable during boot, it can cause the system to hang and drop into emergency mode. systemd provides robust options in /etc/fstab to handle these scenarios gracefully.
Task 1 – The fstab configuration
Instead of relying on legacy automounts or basic auto options, you can leverage systemd-specific options. Here is an example of a resilient CIFS mount entry in /etc/fstab:
//fileserver.example.internal/share /mnt/nfs_share cifs vers=3.0,rw,auto,_netdev,nofail,uid=svc_app,gid=svc_app,credentials=/root/.cifs,x-systemd.requires-mounts-for=/mnt 0 0
Breaking down the key options:
auto: Tellssystemdto mount this during boot automatically._netdev: Marks this filesystem as network-dependent.systemdwill not try to mount it until the network is considered “up” (vianetwork-online.target).x-systemd.requires-mounts-for=/mnt: If your mount point/mnt/nfs_sharesits on top of a separate local Logical Volume (e.g.,/mnt), this tellssystemd: “Before you mount the network share, you must ensure the local/mntvolume is mounted first.” This prevents the network share from trying to mount onto an unavailable directory.nofail: This is critical. If the remote server is down or unreachable, the boot process will continue normally, and the mount will simply fail in the background without breaking the rest of the system or causing an emergency shell.
Task 2 – Ensuring “network-online” is enabled
The _netdev option depends on the concept of network-online. On many systems, network-online.target is not enabled by default, which means services might fire too early.
Enable the wait-online service for your network manager (e.g., NetworkManager):
systemctl enable NetworkManager-wait-online.service
This guarantees the system doesn’t claim the network is online until the interfaces, routing, and DNS are actually usable.
Task 3 – Reloading and applying changes
When you make changes to /etc/fstab, systemd needs to be informed, as it dynamically generates .mount units from the fstab file. If you don’t clear old unit states, systemd might keep using old behavior.
# Reload the systemd manager configuration
systemctl daemon-reload
# Reset any failed states from previous mount attempts
systemctl reset-failed
# If the share was previously mounted with old options, stop it safely
systemctl stop apps-nfs_share.mount 2>/dev/null
# Reload once more to ensure clean state
systemctl daemon-reload
After these steps, your network mounts will wait for the local storage stack, wait for actual network connectivity, and won’t sabotage your boot process if the remote endpoint goes offline.
Architecture Diagram
This diagram supports Ensuring Reliable Network Filesystem Mounts on Boot and highlights where controls, validation, and ownership boundaries sit in the workflow.
Post-Specific Engineering Lens
For this post, the primary objective is: Change storage allocation safely with reversible checkpoints.
Implementation decisions for this case
- Chose a staged approach centered on systemd to avoid high-blast-radius rollouts.
- Used fstab checkpoints to make regressions observable before full rollout.
- Treated nfs documentation as part of delivery, not a post-task artifact.
Practical command path
These are representative execution checkpoints relevant to this post:
lsblk -f
lvdisplay; vgdisplay; pvdisplay
resize2fs /dev/mapper/<lv>
Validation Matrix
| Validation goal | What to baseline | What confirms success |
|---|---|---|
| Functional stability | service availability, package state, SELinux/firewall posture | systemctl --failed stays empty |
| Operational safety | rollback ownership + change window | journalctl -p err -b has no new regressions |
| Production readiness | monitoring visibility and handoff notes | critical endpoint checks pass from at least two network zones |
Failure Modes and Mitigations
| Failure mode | Why it appears in this type of work | Mitigation used in this post pattern |
|---|---|---|
| Incorrect device target | Data loss risk increases immediately | Require device mapping verification and maintenance window gate |
| Insufficient free extents | Resize fails mid-operation | Pre-calculate growth/shrink plan before execution |
| Rollback ambiguity | Recovery time extends during incident | Create snapshot/backup and rollback notes ahead of change |
Recruiter-Readable Impact Summary
- Scope: deliver Linux platform changes with controlled blast radius.
- Execution quality: guarded by staged checks and explicit rollback triggers.
- Outcome signal: repeatable implementation that can be handed over without hidden steps.