[ILUG] Showmount "completeness and accurary"
Conor Daly
conor.daly at oceanfree.net
Thu Jun 27 02:39:15 IST 2002
On Wed, Jun 26, 2002 at 09:12:19AM +0100 or so it is rumoured hereabouts,
Niall O Broin thought:
> The showmount man page says, under BUGS,
>
> The completeness and accurary of the information that showmount displays
> varies according to the NFS server's implementation.
>
> Presuming that it means accuracy, that's an accurate statement. I just had
> occassion to reboot an NFS server and was checking the mounts and clients
> afterwards and noticed that showmount on the server was shwoing a lot of
> mounts that simply weren't there. How can I get showmount back into sync ?
> If I simply remove /var/lib/nfs/rmtab how can I make it be recreated
> correctly ?
I did a little scripteen to clean the rmtab file when (re)starting nfs.
It gets the client hostnames from rmtab, pings to see if the client is alive and
if so, keeps its entries.
###########################
#!/bin/bash
# clean_rmtab
#
# Author: Conor Daly <conor.daly at oceanfree.net>
# License: GPL
#
# A little hack to keep nfs's rmtab file clean. rmtab keeps track
# of nfs mounts across reboots. Anything listed there gets to keep
# its file handle after an nfs restart. When an export gets umounted,
# its entry in rmtab is removed. However, if the client doesn't umount
# the export (eg. a hard reset), the entry remains in the rmtab. This
# can lead to problems. The simplest solution seems to be to ping each
# host listed in rmtab and if the host is up, copy those lines to a tmp
# file. Once all hosts listed have been tested, the tmp file will
# contain entries only for those hosts that are up. The tmp file
# replaces rmtab.
# define both the rmtab and the tmp file and create the tmp file
RMTAB=/var/lib/nfs/rmtab
RMTABTMP=/tmp/rmtab$$.tmp
touch $RMTABTMP
# loop through the hosts listed in $RMTAB
for HOST_NAME in `cat $RMTAB | cut -f1 -d":" | sort -u`; do
# See if $HOST_NAME is alive
ping -c1 $HOST_NAME > /dev/null 2>&1
STATUS=$?
if [ $STATUS -eq 0 ]; then
# if so, copy all references into $RMTABTMP
grep $HOST_NAME $RMTAB >> $RMTABTMP
fi
done
# then replace the original $RMTAB with the clean version
mv -f $RMTABTMP $RMTAB
###########################################
Conor
--
Conor Daly <conor.daly at oceanfree.net>
Domestic Sysadmin :-)
---------------------
Faenor.cod.ie
10:56pm up 34 days, 8:14, 0 users, load average: 0.00, 0.00, 0.00
Hobbiton.cod.ie
10:50pm up 7 days, 22:12, 1 user, load average: 0.30, 0.17, 0.06
More information about the ILUG
mailing list