1. 程式人生 > >NFS服務常見故障排查和解決方法

NFS服務常見故障排查和解決方法

NFS,全名叫Network File System,中文叫網路檔案系統,是LinuxUNIX系統的分散式檔案系統的一個組成部分,可實現在不同網路上共享遠端檔案系統。NFS由Sun公司開發,目前已經成為檔案服務的一種標準之一(RFC1904,RFC1813)。其最大的功能就是可以通過網路,讓不同作業系統的計算機可以共享資料,所以可以把NFS看做是一個檔案伺服器。NFS缺點是其讀寫效能比本地硬碟要差一些。

一、NFS服務常見故障排查:

NFS服務出現了故障,主要從以下幾個方面檢查原因:

(1)檢查NFS客戶機和伺服器的負荷是否太高,Server和Client之間的網路是否正常;

(2)檢查/etc/exports檔案的正確性;

(3)必要時重啟NFS和portmap服務;

(4)執行下列命令重新啟動portmap和NFS:

# /etc/init.d/portmap restart
# /etc/init.d/nfs restart
# /etc/init.d/rpcbind restart (在RHEL/CentOS 6.x裡面)
# chkconfig portmap on
# chkconfig nfs on
# chkconfig rpcbind on (在RHEL/CentOS 6.x裡面)

注意:在RHEL/CentOS 6.x裡面,portmap服務改名為rpcbind服務了;順便說一下,rpcbind服務也是圖形介面的關鍵基礎服務,不啟動此服務,不能啟動圖形桌面。

(5) 檢查Client上的mount命令或/etc/fstab的語法是否正確;

(6) 檢視核心是否支援NFS和RPC服務。一般正常安裝的Linux系統都會預設支援NFS和RPC服務,除非你自己重新編譯的核心,而且沒選擇nfs支援選項編譯。

二、NFS常見故障解決方法:

1、The rpcbind failure error
故障現象:
nfs mount: server1:: RPC: Rpcbind failure
RPC: Timed Out
nfs mount: retrying: /mntpoint
原因:
第一,可能因為客戶機的hosts檔案中存在錯誤的ip地址、主機名或節點名組合;
第二,伺服器因為過載而暫時停止服務。

2、The server not responding error
現象:
NFS server server2 not responding, still trying
原因:
第一,網路不通,用ping命令檢測一下。
第二,伺服器關機。

3、The NFS client fails a reboot error
現象:
啟動客戶機後停住了,不斷顯示如下提示資訊:
Setting default interface for multicast: add net 224.0.0.0: gateway:
client_node_name.
原因:
在etc/vfstab的mount選項中使用了fg而又無法成功mount伺服器上的資源,改成bg或將該行註釋掉,直到伺服器可用為止。

4、The service not responding error
現象:
nfs mount: dbserver: NFS: Service not responding
nfs mount: retrying: /mntpoint
原因:
第一,當前級別不是級別3,用who -r檢視,用init 3切換。
第二,NFS Server守護程序不存在,用ps -ef | grep nfs檢查,用/etc/init.d/nfs start啟動。

5、The program not registered error
現象:
nfs mount: dbserver: RPC: Program not registered
nfs mount: retrying: /mntpoint
原因:
第一,當前級別不是級別3。
第二,mountd守護程序沒有啟動,用/etc/init.d/nfs指令碼啟動NFS守護程序。
第三,看/etc/dfs/dfstab中的條目是否正常。

6、The stale file handle error
現象:
stale NFS file handle
原因:
伺服器上的共享資源移動位置了,在客戶端使用umount和mount重新掛接就可以了。

7、The unknown host error
現象:
nfs mount: sserver1:: RPC: Unknown host
原因:
hosts檔案中的內容不正確。

8、The mount point error
現象:
mount: mount-point /DS9 does not exist.
原因:
該掛接點在客戶機上不存在,注意檢查命令列或/etc/vfstab檔案中相關條目的拼寫。

9、The no such file error
現象:
No such file or directory.
原因:
該掛接點在伺服器上不存在,注意檢查命令列或/etc/vfstab檔案中相關條目的拼寫。

10、No route to host
錯誤現象:
# mount 10.10.11.211:/opt/data/xmldb /c2c-web1/data/xmldb -t nfs -o rw
mount: mount to NFS server ’10.10.11.211′ failed: System Error: No route to host.

原因:
防火牆被開啟,關閉防火牆。
這個原因很多人都忽視了,如果開啟了防火牆(包括iptables和硬體防火牆),NFS預設使用111埠,我們先要檢測是否打開了這個埠,還要檢查TCP_Wrappers的設定。

11、Not owner
現象:
# mount -F nfs -o rw 10.10.2.3:/mnt/c2c/data/resinfo2 /data/data/resinfo2
nfs mount: mount: /data/data/resinfo2: Not owner

原因:
這是Solaris 10版本掛載較低版本nfs時報的錯誤。

解決:
需要用-o vers=3引數

示例:
# mount -F nfs -o vers=3 10.10.2.3:/mnt/c2c/data/resinfo2 /data/data/resinfo2

12、RPC: Program not registered & retrying
現象:
nfs mount: 10.10.2.3: : RPC: Program not registered
nfs mount: retrying: /data/data/resinfo2

原因:
沒有啟動NFS共享端服務。

解決:需要重新啟動share端的NFS服務,
Linux:
mount: RPC: Program not registered
# /etc/init.d/nfs restart

Solaris:
mount: RPC: Program not registered
# /etc/rc.d/init.d/nfs restart

13、can’t contact portmapper: RPC: Remote system error – Connection refused
現象:
# exportfs -a
can’t contact portmapper: RPC: Remote system error – Connection refused

原因:
出現這個錯誤資訊是由於server端的portmap沒有啟動。

解決:
# /etc/init.d/portmap start