Friday, January 13, 2012

NFS , timeo, retrans and i/o error

 NFS , timeo, retrans and i/o error

wget -O- -q checkip.dyndns.org   - to check outgoing IP

/sbin/route add -host 10.2.188.60 gw 10.2.0.1

[root@pc001 ~]# showmount -e 10.2.188.60  | grep msgs
/vol/msgs2                      (everyone)

[root@pc001 ~]# cat /etc/fstab
10.2.188.60:/vol/msgs2  /abc1/msgs2     nfs     rw,bg,intr,soft,wsize=32768,rsize=32768,timeo=600,retrans=2
Mount a nfs share from a server, say 1.2.3.4:/xyz to /nams/xyz using the command
With this replicate the production NFS setting.
To replicate the issue iptables can be used with the help of following command.
iptables --I OUTPUT --p tcp --d 1.2.3.4 --j DROP"; to undo the above run "iptables --F".
With this the thread will hang for the timeo configured value (1 sec in the current example) and will then return an input/output error.
To revert back the iptables settings, the following command can be used
iptables --D OUTPUT --p tcp --d 1.2.3.4 --j DROP"; to undo the above run "iptables --F".

iptables -I OUTPUT -p tcp -d 10.2.188.60 -j DROP
[root@pc001 ~]# touch /abc1/msgs2/a
touch: cannot touch `/abc1/msgs2/a': Input/output error

bg: If the first NFS mount attempt times out, retry the mount in the background. After a mount operation is backgrounded, all subsequent mounts on the same NFS server will be backgrounded immediately, without first attempting the mount. A missing mount point is treated as a timeout, to allow for nested NFS mounts.

Intr: If an NFS file operation has a major timeout and it is hard mounted, then allow signals to interupt the file operation and cause it to return EINTR to the calling program. The default is to not allow file operations to be interrupted.

Soft: If an NFS file operation has a major timeout then report an I/O error to the calling program. The default is to continue retrying NFS file operations indefinitely.

Hard: If an NFS file operation has a major timeout then report an I/O error to the calling program. The default is to continue retrying NFS file operations indefinitely.


rsize=n
The number of bytes NFS uses when reading files from an NFS server. The default value is dependent on the kernel, currently 1024 bytes. (However, throughput is improved greatly by asking for rsize=8192.)
wsize=n
The number of bytes NFS uses when writing files to an NFS server. The default value is dependent on the kernel, currently 1024 bytes. (However, throughput is improved greatly by asking for wsize=8192.)

timeo=n
The value in tenths of a second before sending the first retransmission after an RPC timeout. The default value is 7 tenths of a second. After the first timeout, the timeout is doubled after each successive timeout until a maximum timeout of 60 seconds is reached or the enough retransmissions have occured to cause a major timeout. Then, if the filesystem is hard mounted, each new timeout cascade restarts at twice the initial value of the previous cascade, again doubling at each retransmission. The maximum timeout is always 60 seconds. Better overall performance may be achieved by increasing the timeout when mounting on a busy network, to a slow server, or through several routers or gateways.
retrans=n
The number of minor timeouts and retransmissions that must occur before a major timeout occurs. The default is 3 timeouts. When a major timeout occurs, the file operation is either aborted or a "server not responding" message is printed on the console.

tcp
Mount the NFS filesystem using the TCP protocol instead of the default UDP protocol. Many NFS servers only support UDP.
udp
Mount the NFS filesystem using the UDP protocol. This is the default. All of the non-value options have corresponding nooption forms. For example, nointr means don't allow file operations to be interrupted.


 


rsync with delete option and different ssh port

How to rsync e.g PIPELINE dir from Source to Destination? #rsync -avzr   --delete-before  -e "ssh -p $portNumber"  /local...