Mounting NFS file systems on Unix/Linux Which command is used to mount a remote NFS export into the local directory tree?
-
Anfsmount
-
Bknfsd
-
Cmount
-
DAll of the above
-
ENone of the above
Answer
Correct Answer: mount
Explanation
Introduction / Context:Network File System (NFS) allows directories to be shared across machines. On the client side, the standard way to attach a remote NFS export to a local mount point is with the system's mount utility. Recognizing the correct tool avoids confusion with server daemons and legacy helper names.
Given Data / Assumptions:
- A remote NFS server exports a directory (for example, server:/share).
- We need to mount it locally (for example, at /mnt/share).
- Appropriate NFS client packages are installed.
Concept / Approach:
The mount command is the general-purpose utility for attaching filesystems. With NFS, you either specify the -t nfs or rely on autodetection. Systemd-based systems may also use mount units or fstab entries, but the underlying action still uses mount to bind the remote export into the local namespace.
Step-by-Step Solution:
Create a local mount point: mkdir -p /mnt/share.Run: mount -t nfs server:/share /mnt/share.Verify with: df -h or mount | grep /mnt/share.For persistence, add a line to /etc/fstab with the nfs type and options.Verification / Alternative check:
Confirm access by listing contents (ls /mnt/share). If mounting fails, check firewall, exports on the server (/etc/exports), and version negotiation (for example, vers=3 or vers=4).
Why Other Options Are Wrong:
- nfsmount: largely historical/legacy helper; modern systems use mount directly.
- knfsd: refers to kernel NFS server daemon side, not the client command.
- All of the above: inaccurate because the correct, current client command is mount.
- None of the above: incorrect because mount is correct.
Common Pitfalls:
Forgetting to create the mount point, missing user-space rpcbind or nfs-utils on older setups, and neglecting to specify correct mount options for performance and security.
Final Answer:
mount