When exportfs -arv takes forever
Saturday, March 11th, 2006I had the strangest problem with my server for the last months. Starting nfsd on my Archlinux machine took forever and I couldn’t figure out why. Stracing `exportfs -arv` showed a lot of DNS queries were done; which is strange since my nfs server is only available to machines on the internal network (and those are all listed in /etc/hosts as well). I quickly found out that removing the nameservers from /etc/resolv.conf would somehow fix this problem; nfsd would start instantly. A lot of strange IP addresses showed up while tracing, but I couldn’t quickly find out where they came from. When I was ready to modify my nfsd startup script to empty the resolv.conf before starting; I started a last serie of Google queries. And guess what. I found it.
Searching for ‘exporting “to kernel” exportfs’ (the message exportfs gave while running, and which contained the strange IP addresses) pointed me to [nSLUG] Re: Help with NFS, plz?. This thread mentioned a file `/var/lib/nfs/rmtab`; which, when I viewed it, actually contained those strange IP addresses. Somehow nfsd had stored all the hosts that made nfs-requests; including many old and dead ones. It seemed a reverse DNS lookup was done for each IP address in there; resulting in a lot of lookups that were never satisfied. The problem was solved by emptying the rmtab file.