2010年12月18日 星期六

[Linux 小學堂] 如何啟動 NFS


Source (鳥哥)
啟動 NFS
設定檔搞定後,當然要開始來啟動才行啊!而前面我們也提到過,NFS 的啟動還需要 portmap 的協助才行啊! 所以趕緊來啟動吧!

tw-johnklee4:~ # /etc/init.d/portmap start
# 如果 portmap 本來就已經在執行了,那就不需要啟動啊!

tw-johnklee4:~ # /etc/init.d/nfsserver start
#啟動NFS

tw-johnklee4:~ # vi /etc/exports <檢查掛載Point>
# See the exports(5) manpage for a description of the syntax of this file.
# This file contains a list of all directories that are to be exported to
# other computers via NFS (Network File System).
# This file used by rpc.nfsd and rpc.mountd. See their manpages for details
# on how make changes in this file effective.
/media/SLES100_001 *(ro,sync)
#/data (rw,sync)
/data 192.168.0.178/24(rw,sync)

那個 portmap 根本就不需要設定!只要直接啟動他就可以啦!啟動之後,會出現一個
port 111 的 sunrpc 的服務,那就是 portmap 啦!至於 nfs 則會啟動至少兩個以上的 daemon
出現!然後就開始在監聽 Client 端的需求啦!你必須要很注意螢幕上面的輸出資訊,
因為如果設定檔寫錯的話,螢幕上會顯示出錯誤的地方.

在確認沒有問題之後,接下來我們來瞧一瞧那麼 NFS 到底開了哪些埠口?
tw-johnklee4:~ #netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3267/portmap
tcp 0 0 0.0.0.0:883 0.0.0.0:* LISTEN 7067/rpc.mountd
... (以下省略) ...

注意看到上面喔!總共產生了好多的 port 喔!真是可怕!不過主要的埠口是:
* portmap 啟動的 port 在 111;
* NFS 啟動的 port 在 2049;
* 其他 rpc.daemons 啟動的 port 則是隨機產生的,因此需向 port 111 註冊。


好了,那我怎麼知道每個 RPC 服務的註冊狀況?沒關係,妳可以使用 rpcinfo 來處理的。
syntax:
[root@linux ~]# rpcinfo [-p] [IP|hostname]
參數:
-p :顯示出所有的 port 與 porgram 的資訊;


tw-johnklee4:~ # rpcinfo -p localhost
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
...(以下省略)...

仔細瞧瞧,上面出現的資訊當中除了程式名稱與埠口的對應可以與 netstat -tlunp
輸出的結果作比對之外,還需要注意到 NFS 的版本支援!新的 NFS 版本傳輸速度較快,
由上表看起來,我們的 NFS 至少支援到第 3 版如果妳的 rpcinfo 無法輸出,那就表示
註冊的資料有問題啦!可能需要重新啟動.
portmap 與 nfs 喔

延伸閱讀: 

補充說明 :
柏青哥的 SuSE : 第十五章 架 設 NFS 及 NIS Server
NFS 全名為 Network File System ( 網路檔案系統 ),主要是讓 Unix-Like 主機之間,能透過掛載的方式來存取對方所分享出來的資源,也就是說 NFS Client 是將 NFS Server 所提供的分享目錄掛載至本地端主機下,就好比是在本機操作般一樣...
This message was edited 5 times. Last update was at 15/06/2010 13:38:09

沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...