====== NFS Shares ====== **General Information** Creating NFS shares on a server and connecting to them via a client. **Checklist** * Distro(s): Enterprise Linux 7 * Other: Two systems (server and client) ---- ====== NFS Server Setup ====== * Install required packageyum install nfs-utils * Start and enable the NFS Serversystemctl start nfs-server systemctl enable nfs-server * Create your share directory structuremkdir -p /data/share1 * Create an export line to share the directoryvim /etc/exports /data/share1 192.168.1.0/24(rw) * /data/share1 => the directory to share * 192.168.1.0/24(rw) => share to entire network with read/write. * Other ways to share are to specify single hostnames(short, fqdn, single ip), IP networks (as shown), hostnames/domains with wildcards (*.mydomain.edu). See man exports for more details. * If a firewall is running, allow nfs, rpc-bind, and mountdfirewall-cmd --permanent --add-service=nfs firewall-cmd --permanent --add-service=rpc-bind firewall-cmd --permanent --add-service=mountd firewall-cmd --reload * nfs (tcp/udp 2049) => needed for NFSv4 * rpc-bind (tcp/udp 111) => needed for NFSv3 compatibility and for showmount to work from client * mountd (tcp/udp 20048) => needed for the "showmount -e hostname" command to work from a client ---- ===== NFS Server: Increasing NFS Threads ===== To increase NFS server performance, it is usually necessary to increase the number of NFS daemon processes running. (The default is very small at 8.) * CentOS 7 * Edit the following config filevim /etc/sysconfig/nfs # Number of nfs server processes to be started. # The default is 8. RPCNFSDCOUNT=16 * Restart the nfs-config servicesystemctl restart nfs-config * Restart the nfs servicesystemctl restart nfs-server * Verify * NFS running sysconfig (takes effect after nfs-config restart)cat /run/sysconfig/nfs-utils RPCNFSDARGS=" 16" * "th" line in proc (number after 'th' is number of processes)grep th /proc/net/rpc/nfsd th 16 0 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 * Running processesps -elf | grep nfsd] | grep -v grep | wc -l 16 ---- ====== NFS Client Setup ====== * Install required packageyum install nfs-utils * View available mounts on NFS Servershowmount -e fileserver01 Export list for fileserver01: /data/share1 192.168.1.0/24 * Mount temporarilymount -t nfs fileserver01:/data/share1 /mnt * Mount persistentlyvim /etc/fstab ## NFS Shares ## fileserver01:/data/share1 /remote nfs _netdev 0 0 * _netdev => Mount option to skip mounting this location until the network is available. ----