1. 程式人生 > >NFS搭建錯誤處理:exportfs:No options for /home/source/*(rw,sync,no_root_squash):suggest(sync) to avoid warn

NFS搭建錯誤處理:exportfs:No options for /home/source/*(rw,sync,no_root_squash):suggest(sync) to avoid warn

一,NFS搭建步驟:

     1.安裝Ubuntu NFS服務:
           ---> apt-get install nfs-kernel-server
                • 安裝過程彈出對話,選擇Y,回車繼續安裝

     2.配置/etc/exports
       – 最後一行新增/home/source/ *(rw,sync,no_root_squash)
         /home/source/表示要共享的目錄,根據實際情況修改
        – *:代表允許所有的網路段訪問
      – rw:是可讀寫許可權
     – ync:是資料同步寫入記憶體和硬碟
      – no_root_squash:是Ubuntu nfs 客戶端分享目錄使用者的許可權,如果客戶端使用的是root 使用者,那麼對於該共享目錄而言,該客戶端就具有root 許可權


    3 .重啟portmap 服務
        – /etc/init.d/portmap restart

[email protected]:/home/source# /etc/init.d/portmap restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop portmap ; start portmap. The restart(8) utility is also available.
portmap stop/waiting
portmap start/running, process 15124


    4.重啟nfs 服務
       – /etc/init.d/nfs-kernel-server restart

   

[email protected]:/home/source# /etc/init.d/nfs-kernel-server  restart
 * Stopping NFS kernel daemon                                             [ OK ] 
 * Unexporting directories for NFS kernel daemon...                       [ OK ] 
 * Exporting directories for NFS kernel daemon...                              
exportfs: No options for /home/source/*(rw,sync,no_root_squash) : suggest (sync) to avoid warning
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export ":/home/source/*(rw,sync,no_root_squash)".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

exportfs: Failed to stat /home/source/*(rw,sync,no_root_squash): No such file or directory
                                                                          [ OK ]
 * Starting NFS kernel daemon                                             [ OK ]

5.測試NFS功能:

[email protected]:/home/source# mount -t nfs localhost:/home/source/system /mnt
mount.nfs: access denied by server while mounting localhost:/home/source/system

二.錯誤分析:

這裡可以看出NFS掛載失敗。問題在於重啟的時候失敗,報錯:exportfs: No options for /home/source/*(rw,sync,no_root_squash) : suggest (sync) to avoid warning
exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export ":/home/source/*(rw,sync,no_root_squash)". 

這裡是把配置/etc/exports
       – 最後一行新增/home/source/ *(rw,sync,no_root_squash)------>改成/home/source *(rw,sync,no_root_squash,no_subtree_check)就OK了。

執行結果:

[email protected]:/home/source# /etc/init.d/portmap restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop portmap ; start portmap. The restart(8) utility is also available.
portmap stop/waiting
portmap start/running, process 15511
[email protected]:/home/source# /etc/init.d/nfs-kernel-server  restart
 * Stopping NFS kernel daemon                                             [ OK ] 
 * Unexporting directories for NFS kernel daemon...                       [ OK ] 
 * Exporting directories for NFS kernel daemon...                         [ OK ] 
 * Starting NFS kernel daemon                                             [ OK ] 
[email protected]:/home/source# mount -t nfs localhost:/home/source/system /mnt
[email protected]:/home/source#