Mount NFS Share on CentOS 6: rpcbind, NFSv4 Defaults, idmapd and fstab

This guide mounts an NFS share on a CentOS 6 client. CentOS 6 changed two things compared to CentOS 5. rpcbind replaced portmap, and mount -t nfs tries NFSv4 first, falling back to NFSv3 if the server doesn’t offer v4. Most CentOS 6 NFS problems come from the NFSv4 default.

On CentOS 5? Follow Mount NFS Share on CentOS 5: NFSv3 Client with portmap, fstab and RPC Troubleshooting, which covers portmap, nfslock and RPC troubleshooting for NFSv3.

1. Install nfs-utils and start rpcbind

yum install nfs-utils
service rpcbind start
chkconfig rpcbind on

Older guides, including an earlier version of this one, say service portmap start. There’s no portmap service on CentOS 6. rpcbind replaces it.

2. Create a mount point and mount

mkdir /mnt/NFS
mount -t nfs 192.168.1.112:/NFS /mnt/NFS
mount -t nfs 192.168.1.112:/NFS /mnt/NFS on a CentOS 6 client

Check it with df -h:

df -h showing 192.168.1.112:/NFS mounted on /mnt/NFS

3. Check which NFS version you got

nfsstat -m
grep /mnt/NFS /proc/mounts

Look for vers=4 or vers=3 in the options. To force a version, for example for an old server, use:

mount -t nfs -o vers=3 192.168.1.112:/NFS /mnt/NFS

4. Fix files owned by nobody:nobody (NFSv4 ID mapping)

NFSv4 sends user and group names instead of numeric IDs. If the client and server don’t agree on the NFSv4 domain, every file shows up as nobody:nobody. Set the same domain on both machines in /etc/idmapd.conf:

[General]
Domain = example.com

Then restart the ID mapper and remount:

service rpcidmapd restart
umount /mnt/NFS && mount /mnt/NFS

5. Make it permanent in /etc/fstab

vi /etc/fstab
192.168.1.112:/NFS   /mnt/NFS   nfs   defaults,_netdev   0 0

_netdev marks it as a network filesystem. The netfs service then mounts it after the network comes up, instead of the boot hanging on it:

chkconfig netfs on

Test the entry. This mounts everything in fstab, so run it during off-hours:

mount -a
mount -a completing with no errors on CentOS 6

A final df -h confirms the share is mounted:

df -h after mount -a confirming the NFS share on /mnt/NFS

Quick troubleshooting

  • “mount.nfs: access denied by server”: check /etc/exports on the server and the export path. Some NFSv4 servers export a pseudo-root (fsid=0), so the path you mount is relative to it.
  • Slow mount, then success: the client tried v4, timed out and fell back to v3. Set vers=3 in fstab, or enable v4 on the server.
  • For I/O errors on an existing mount, see input/output error from NFS client on CentOS.

Unmount

umount /mnt/NFS

It’s umount, not “unmount”. I’ve made that mistake thousands of times. For the server side, see Setup NFS Server on CentOS 6.

That’s It! If you found this article helpful, zwiegnet.com/go for Linux Consulting

Related guides: Setup NFS Server on CentOS 6 | input/output error from NFS client on CentOS

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *