User Tools

Site Tools


Setting up NFS with CentOS


Create a directory to share. For security reasons we dont allow root to use the share.

mkdir /mnt/share
chown nobody:nfsnobody /data/nfs_share
#groupnames can vary between CentOS 5 and CentOS 6

On the server you have to put the shared directory in your /etc/exports

#You can restrict the access to certain hosts, domains or networks
/mnt/share *

After that export your new nfs filesystem(s):

exportfs -av


The following text is copied from the official RHEL 6 Storage Administration Guide. The default NFS Options are:

Option Description
ro The exported file system is read-only. Remote hosts cannot change the data shared on the file system. To allow hosts to make changes to the file system (i.e. read/write), specify the rw option.
sync The NFS server will not reply to requests before changes made by previous requests are written to disk. To enable asynchronous writes instead, specify the option async.
wdelay The NFS server will delay writing to the disk if it suspects another write request is imminent. This can improve performance as it reduces the number of times the disk must be accesses by separate write commands, thereby reducing write overhead. To disable this, specify the no_wdelay; note that no_wdelay is only available if the default sync option is also specified.
root_squash This prevents root users connected remotely (as opposed to locally) from having root privileges; instead, the NFS server will assign them the user ID nfsnobody. This effectively “squashes” the power of the remote root user to the lowest local user, preventing possible unauthorized writes on the remote server. To disable root squashing, specify no_root_squash.



  1 # /etc/fstab
  2 LABEL=/                 /                       ext3    defaults        1 1
  3 LABEL=/inetpub          /inetpub                ext3    defaults        1 2
  4 LABEL=/boot1            /boot                   ext3    defaults        1 2
  5 tmpfs                   /dev/shm                tmpfs   defaults        0 0
  6 devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
  7 sysfs                   /sys                    sysfs   defaults        0 0
  8 proc                    /proc                   proc    defaults        0 0
  9 LABEL=SWAP-sda3         swap                    swap    defaults        0 0
 10    /mnt/nfs        nfs     _netdev 0       0

The argument '_netdev' tells the system to wait until the network interface is up before mounting.

Remount fstab

mount -a

Notes and Links:

linux/nfs.txt · Last modified: 2013/02/23 17:21 by