Gestione e Troubleshooting del servizio NFS

Essendo il servizio NFS gestito dal kernel e da processi che girano in user-space occorre verificare l'effettivo supporto del kernel e verificare lo status di alcuni demoni.

Per verificare che il proprio kernel supporti nfs, ci si può appoggiare al proc filesystem, visualizzando il contenuto del file /proc/filesystem, se all'interno di questo file è presente una entry simile nodev    nfs, significa che il kernel supporta il suddetto filesystem.
[root@draco root]# cat /proc/filesystems
nodev    rootfs
nodev    bdev
nodev    proc
nodev    sockfs
nodev    tmpfs
nodev    shm
nodev    pipefs
nodev    binfmt_misc
    ext3
    ext2
nodev    coda
    iso9660
nodev    devfs
    vxfs
nodev    nfs
nodev    smbfs
    ntfs
    affs
nodev    autofs
    reiserfs
nodev    devpts
nodev    usbdevfs


Per quanto riguarda i servizi e i processi che girano in user space occorre appoggiarsi ai soliti comandi per il  troubleshooting dei servizi di network, come netstat per verificare le porte in listening e ps per visualizzare i processi attivi.
I servizi attivi per un server dovranno essere portmap (rpc.statd, rpc.quotad, rpciod), e il demone nfs (nfsd, lockd) attivabili tramite gli script di gestione del servizio (per Redhat):
/etc/rc.d/init.d/nfs
/etc/rc.d/init.d/nfslock
/etc/rc.d/init.d/portmap


Mentre per un client è necessario attivare solo portmap.
[root@draco root]# ps -adef
UID        PID  PPID  C STIME TTY          TIME CMD
[...]
root       444     1  0 Mar18 ?        00:00:00 syslogd -m 0
root       449     1  0 Mar18 ?        00:00:00 klogd -2
rpc        469     1  0 Mar18 ?        00:00:00 portmap
rpcuser    497     1  0 Mar18 ?        00:00:00 rpc.statd
root       666     1  0 Mar18 ?        00:00:00 rpc.rquotad
root       676     1  0 Mar18 ?        00:00:00 [nfsd]
root       677     1  0 Mar18 ?        00:00:00 [lockd]
root       678   677  0 Mar18 ?        00:00:00 [rpciod]
root       679     1  0 Mar18 ?        00:00:00 [nfsd]
root       680     1  0 Mar18 ?        00:00:00 [nfsd]
root       681     1  0 Mar18 ?        00:00:00 [nfsd]
root       682     1  0 Mar18 ?        00:00:00 [nfsd]
root       683     1  0 Mar18 ?        00:00:00 [nfsd]
root       684     1  0 Mar18 ?        00:00:00 [nfsd]
root       685     1  0 Mar18 ?        00:00:00 [nfsd]
root     18513     1  0 Mar21 ?        00:00:00 rpc.mountd
[...]


Il comando netstat ci permette di verificare che le porte siano realmente in listening e la relazione porte e servizio.
[root@draco root]# netstat -nap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name  
tcp        0      0 0.0.0.0:32768           0.0.0.0:*               LISTEN      497/rpc.statd      
tcp        0      0 0.0.0.0:50789           0.0.0.0:*               LISTEN      9911/rpc.mountd    
tcp        0      0 0.0.0.0:41546           0.0.0.0:*               LISTEN      18513/rpc.mountd    
[...]      
tcp        0      0 0.0.0.0:846             0.0.0.0:*               LISTEN      666/rpc.rquotad    
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      469/portmap        
tcp        0      0 0.0.0.0:758             0.0.0.0:*               LISTEN      9906/rpc.rquotad    
tcp        0      0 127.0.0.1:860           127.0.0.1:111           TIME_WAIT   -                  
udp        0      0 0.0.0.0:32768           0.0.0.0:*                           497/rpc.statd      
udp        0      0 0.0.0.0:33031           0.0.0.0:*                           18513/rpc.mountd    
udp        0      0 0.0.0.0:33045           0.0.0.0:*                           9911/rpc.mountd    
udp        0      0 0.0.0.0:673             0.0.0.0:*                           497/rpc.statd      
udp        0      0 0.0.0.0:843             0.0.0.0:*                           666/rpc.rquotad    
udp        0      0 0.0.0.0:111             0.0.0.0:*                           469/portmap        
udp        0      0 0.0.0.0:755             0.0.0.0:*                           9906/rpc.rquotad    
[...]


Oppure tramite l'utility rpcinfo che esegue un "probe" su di un host per verificare quali servizi si appoggiano a rpc.
[root@draco root]# rpcinfo -p
   program vers proto   port
    100000    2   tcp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp  32768  status
    100024    1   tcp  32768  status
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100021    1   udp  32770  nlockmgr
    100021    3   udp  32770  nlockmgr
    100021    4   udp  32770  nlockmgr
    100011    1   udp    755  rquotad
    100011    2   udp    755  rquotad
    100011    1   tcp    758  rquotad
    100011    2   tcp    758  rquotad
    100005    1   udp  33045  mountd
    100005    1   tcp  50789  mountd
    100005    2   udp  33045  mountd
    100005    2   tcp  50789  mountd
    100005    3   udp  33045  mountd
    100005    3   tcp  50789  mountd


Per la gestione e visualizzazione delle share esportate occorre appoggiarsi all'utility exportfs.
Visualizzazione delle share
[root@draco root]# exportfs
/home/ksfile      10.0.0.0/255.255.255.0
/home/kernel      10.0.0.0/255.255.255.0
/export           10.0.0.0/255.255.255.0
[root@draco root]# exportfs -v
/home/ksfile      10.0.0.0/255.255.255.0(ro,async,wdelay,no_root_squash)
/home/kernel      10.0.0.0/255.255.255.0(ro,async,wdelay,no_root_squash)
/export           10.0.0.0/255.255.255.0(ro,async,wdelay,no_root_squash)
Rilettura del file di configurazione /etc/export.
Comando utile per i cambiamenti in modalità run-time

[root@draco root]# exportfs -arv
exporting 10.0.0.0/255.255.255.0:/home/kernel
exporting 10.0.0.0/255.255.255.0:/home/ksfile
exporting 10.0.0.0/255.255.255.0:/export


Per avere statistiche e informazioni sul funzionamento di NFS, l'utility nfsstat fornisce varie utili opzioni:
Visualizzazione delle statistiche lato server
[root@draco root]# nfsstat -s
Server rpc stats:
calls      badcalls   badauth    badclnt    xdrcall
18729       0             0              0           0      
Server nfs v2:
null       getattr    setattr    root       lookup     readlink
0   0%   0   0%    0   0%    0   0%   0   0%      0   0%
read       wrcache    write      create     remove     rename
0   0%   0   0%      0    0%   0    0%   0    0%      0   0%
link       symlink    mkdir      rmdir      readdir    fsstat
0   0%   0   0%      0    0%   0    0%   0    0%      0   0%
[...]

Privacy Policy