mount.nfs: Input/output error When Mounting From CentOS 5.9 to 6.4

Was trying to mount a NFS shared folder on CentOS 6.4 from CentOS 5.9 and found a really tricky problem. I’ve added the /etc/fstab entry, but once I ran mount /my/folder it stuck for 2-3 minutes and came back saying

mount.nfs: Input/output error

Things I’ve Tried

This is all the things I’ve tried with no success:

  • Ensured network connection was ok. I checked the firewall / iptables and made sure the client machine can connect to NFS server
  • Checked my /etc/hosts file, ensured no dodgy entries
  • Double checked /etc/exports and ran exportfs -r on the NFS server
  • Ran showmount -e [host_ip] to check the NFS server really does advertise the shared folders
  • Ran rpcinfo -p [host_ip] to check the version and supporting services are available
  • Rebooting the server many times


Thanks to this post from forum, the solution was to add nolock option to the /etc/fstab file. /mnt/nfs/my/folder nfs nolock 0 0

CentOS manual is pretty vague as well on what this option really does, but oh well it seems to do the job for time being

nolock — Disables file locking. This setting is occasionally required when connecting to older NFS servers.


CentOS / RHEL NFS Share Network Folder Mounting


We are building a second web server with a hope of installing a load balancer soon. We came into a problem where we have to synchronize the file contents between multiple servers. The solution we’re opting is to install and mount a shared network folder (NFS) visible from both web servers. The shared folder lives on its own server (aka file system server).

It is assumed:

  1. The file system server host (Master) is
  2. The client is
  3. The folder to be shared on master is /var/www/vhosts
  4. The folder will be mounted to /mnt/nfs/var/www/vhosts on client

Creating a NFS Share on the File System Server

Perform these steps on the file system server (aka “Master”):

  1. Install nfs-utils and nfs-utils-lib package using yum:
    yum install nfs-utils nfs-utils-lib
    Use yum list installed to check if the packages are already installed
  2. Turn on nfs service so it automatically starts on boot
    chkconfig nfs on
    Use chkconfig --list to check status of all services
  3. Start rpcbind and nfs service
    service rpcbind start
    service nfs start
  4. Edit /etc/exports file and add following line at the end
    See here for explanation of the options
  5. Run following command to apply the changes
    exportfs -a

Mounting it on the Client

Following steps will mount the network folder permanently (folder will automatically re-mount on server reboot). Perform this on the client server:

  1. Similar to server, ensure nfs-utils and nfs-utils-lib are installed
    yum install nfs-utils nfs-utils-lib
  2. Create the directory that will hold the mount (mount point)
    mkdir -p /mnt/nfs/var/www/vhosts
  3. Edit /etc/fstab file and append following line /mnt/nfs/var/www/vhosts nfs defaults 0 0
  4. Run mount /mnt/nfs/var/www/vhosts to apply the mounting. Check if the mounting is successful using df -h

OS User on Master and Client

To ensure file system operations are consistent, consider propagating same OS user setup between the master and client. Note that although same username exists on both master and client they don’t necessarily have the same UID.

  • Checking uid and group of user jim:
    $ id jim
    uid=506(jim) gid=505(xyzco) groups=505(xyzco)

    (jim has uid 506 and belongs to group xyzco)
  • Adding a new user jim with uid 506
    useradd -u 506 jim
  • Adding jim to the group xyzco
    usermod -G xyzco jim
  • Setting / resetting password for jim
    passwd jim

Thanks To

Additional Reading