Script to fix NFS (Debian Squeeze + Backports bits)

I have a NFS server running Debian Squeeze. Additionally it’s using the 3.2.x kernel from backports, and the nfs-kernel-server from backports too.

Sometimes NFS breaks, and gives helpful messages like :

mount.nfs: connection timed out

or just:

Stale NFS handle on clients.


While I’m confident that my /etc/exports and other configuration files are correct, it still insists on misbehaving.

Below is a random shell script I seem to have created to fix the NFS server –

set -e
/etc/init.d/nfs-kernel-server stop
/etc/init.d/nfs-common stop
/etc/init.d/rpcbind stop

rm -Rf /var/lib/nfs
mkdir /var/lib/nfs
mkdir /var/lib/nfs/v4recovery /var/lib/nfs/rpc_pipefs

for f in /var/lib/nfs/etab \
/var/lib/nfs/rmtab \
/var/lib/nfs/xtab; do
[ -e $f ] || touch $f

/etc/init.d/rpcbind start
sleep 2
/etc/init.d/nfs-common start
sleep 2
/etc/init.d/nfs-kernel-server start

echo "NFS may now work"

exportfs -f

Yes… “NFS may now work” … that sums it up about right.


  1. Hi, I came across these posts about a week ago while having these same issues (related to 3.2.0-0.bpo.4 and NFS). I just thought I’d let you know that if you still have problems, this issue is related to a problem with the nfsd stack in this kernel.


    I was able to permanently resolve these issues by building a kernel based on 3.9 and the config file distributed with 3.2.0-0.bpo.4 (for me, /boot/config-3.2.0-0.bpo.4-686-pae). I did need to go into ‘make menuconfig’ and reenable NAT under the netfilter conf – otherwise the problem is resolved.



Leave a comment

Your email address will not be published.