NFS server 與 client 配置
因為要進行一項操作,需要配置 NFS client 和 server。
出了很多次錯。最後終於搞成了。
記錄一下過程:
NFS server 端:
[root@server ~]# uname -a
Linux server.test.com 2.6.32-431.el6.x86_64 #1 SMP Wed Nov 20 23:56:07 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
NFS client 端:
[root@client1 ~]# uname -a
Linux client1 4.1.12-61.1.28.el6uek.x86_64 #2 SMP Thu Feb 23 20:03:53 PST 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@client1 ~]#
目的: 想要把 /refresh/home/mypatch 對映到 客戶端的 /var/patch 目錄。
NFS server 端配置:
編輯 /etc/exports:
[root@server ~]# cat /etc/exports
/refresh/home/mypatch 10.65.45.238(rw,sync)
[root@server ~]#
在 NFS client 端,進行檢查:
showmount server.test.com -e
總是出錯:
clntudp_create: RPC: Program not registered
按照一些網站上說得:
/etc/init.d/rpcbind stop
/etc/init.d/nfs stop
/etc/init.d/nfs start
/etc/init.d/rpcbind start
仍然不行、錯誤依舊無變化。
後來,在 NFS server 端執行了:
rpc.mountd
此後,再從 NFS client 訪問,發現起了變化:
[root@client1 ~]# showmount server.test.com -e
Export list for server.test.com:
再回到 NFS server 端,執行:
rpc.nfsd
再回到 NFS client, 再檢驗,出錯資訊再次變化:
[root@client1 ~]# mount -t nfs server.test.com:/refresh/home/mypatch /var/patch
mount.nfs: access denied by server while mounting server.test.com:/refresh/home/mypatch
[root@client1 ~]#
再次回到 NFS server 端,執行:
service nfs restart
再次回到 NFS client 端,此時輸出正常了:
[root@client1 ~]# showmount server.test.com -e
Export list for server.test.com:
/refresh/home/mypatch 10.65.45.238
[root@client1 ~]#
此時,在 NFS client 端,進行手動 mount:
[root@client1 ~]# mount -t nfs server.test.com:/refresh/home/mypatch /var/patch
[root@client1 ~]#
檢查:
[root@client1 ~]# ls -lrt /var/patch
total 2331640
-rw-r--r-- 1 nobody nobody 2387594772 Jul 24 13:39 p32928749_122010_Linux-x86-64.zip
[root@client1 ~]#
終於成功了。