NFS server 与 client 配置

返回:Linux/Unix 索引页

因为要进行一项操作,需要配置 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 ~]#

终于成功了。
返回:Linux/Unix 索引页

posted @ 2021-07-25 13:10  健哥的数据花园  阅读(609)  评论(0编辑  收藏  举报