User Tools

Site Tools


nfs_server_on_centos_6

NFS server on CentOS 6

Installation

Packages

yum groupinstall "NFS server"

Configuration

NFS options

In this example we disable NFS4

/etc/sysconfig/nfs
# Port rquotad should listen on.
RQUOTAD_PORT=875
# TCP port rpc.lockd should listen on.
LOCKD_TCPPORT=32803
# UDP port rpc.lockd should listen on.
LOCKD_UDPPORT=32769
# Turn off v4 protocol support
RPCNFSDARGS="-N 4"
# Number of nfs server processes to be started.
# The default is 8. 
RPCNFSDCOUNT=128
# Port rpc.mountd should listen on.
MOUNTD_PORT=892
# Port rpc.statd should listen on.
STATD_PORT=662
# Outgoing port statd should used. The default is port
# is random
STATD_OUTGOING_PORT=2020
# Specify callout program 
# To enable RDMA support on the server by setting this to
# the port the server should listen on
RDMA_PORT=20049 

Iptables

/etc/sysconfig/iptables
   
.
.
-A INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 32803 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 32769 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 662 -j ACCEPT
.
.

Hardware RAID

Configure the cache ratio: 75% read, 25% write. On HP we use hpacucli

hpacucli ctrl all show config detail
hpacucli ctrl slot=0 modify cacheratio=75/25

Linux parameters

/etc/rc.d/rc.local
# NFS ESXi
# Configuring the Linux I/O Scheduler
echo "noop" > /sys/block/sda/queue/scheduler
# Configuring Disk Read-Ahead. Set read-ahead cache to 512KB
/sbin/blockdev --setra 1024 /dev/sda
/etc/sysctl.conf
.
.  
# ESXi NFS settings
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65535 16777216
net.core.netdev_max_backlog = 30000
vm.dirty_background_ratio = 1
vm.dirty_expire_centisecs = 1000
vm.dirty_ratio = 10
vm.dirty_writeback_centisecs = 100
vm.vfs_cache_pressure = 40

Mount and exports

/etc/fstab
.
.
/dev/mapper/system-nfs  /mnt/storage            ext4    defaults,noatime,data=journal 1 2
mount -a
/etc/exports
.
.
/mnt/storage/vmware *(rw,insecure,sync,no_wdelay,no_root_squash)
nfs_server_on_centos_6.txt · Last modified: by herwarth