showmountmount -t nfsautofsmount -t cifs| Protocol | Primary Use Case |
|---|---|
| NFS (Network File System) | The standard for sharing storage between Linux/Unix systems |
| SMB/CIFS (Samba) | Interoperating with Windows file shares, or Linux systems serving Windows clients |
# Discover what an NFS server is exporting, before mounting anything showmount -e nfsserver.example.com # Create a mount point sudo mkdir -p /mnt/nfsdata # Mount an NFS export sudo mount -t nfs nfsserver.example.com:/exports/data /mnt/nfsdata # Confirm it mounted df -h /mnt/nfsdata # Unmount when done sudo umount /mnt/nfsdata
showmount queries the older mountd service. An NFSv4-only server may not answer it, even though mounting still works.# /etc/fstab entry for an NFS mount nfsserver.example.com:/exports/data /mnt/nfsdata nfs defaults 0 0 # Test it without rebooting, same as any fstab entry (Chapter 10) sudo mount -a
_netdev, nofail, and timeouts.autofs mounts a share when it's first accessed and unmounts it after a period of inactivity, avoiding the boot-time risk of a static fstab entry.
# Install autofs if not already present sudo dnf install autofs # /etc/auto.master — maps a mount point prefix to a map file /mnt/auto /etc/auto.mnt
/etc/auto.master.d/mnt.autofs.# /etc/auto.mnt — the actual map, defining what mounts where # key options location data -fstype=nfs,rw nfsserver.example.com:/exports/data # Enable and start the service sudo systemctl enable --now autofs # Accessing this path triggers the mount automatically ls /mnt/auto/data
mount is needed. autofs creates /mnt/auto/data on access.# Install the CIFS mount utilities if needed sudo dnf install cifs-utils # Mount a Windows/Samba share, prompting for a password sudo mount -t cifs //fileserver.example.com/shared /mnt/winshare -o username=student # Store credentials in a protected file instead of typing them each time sudo mount -t cifs //fileserver.example.com/shared /mnt/winshare -o credentials=/etc/samba/creds
# /etc/fstab entry using a credentials file //fileserver.example.com/shared /mnt/winshare cifs credentials=/etc/samba/creds 0 0 # /etc/samba/creds contains: username=student password=secret # Lock it down sudo chmod 600 /etc/samba/creds
# Confirm basic network reachability to the server ping nfsserver.example.com # Confirm the export is actually visible showmount -e nfsserver.example.com # Check what's currently mounted, and how mount | grep nfs # Check recent kernel/service messages related to the mount journalctl -xe | grep -i nfs
| Symptom | Likely Cause |
|---|---|
| Mount hangs indefinitely | Server unreachable, or firewall blocking the required ports |
| "Permission denied" after mounting | Server-side export permissions or client UID/GID mismatch |
| Mount succeeds but disappears later | autofs idle timeout (expected) vs. an unexpected disconnect (not expected) |
/etc/fstab entry for an NFS share be risky at boot time if the server is unreachable?//fileserver.example.com/shared on /mnt/winshare using the credentials file /etc/samba/creds.