在客户端操作的:
1. 检查客户端有没有安装nfs-utils和rpcbind软件程序 (这两个必须安装)
[root@web01 ~]# rpm -qa nfs-utils rpcbind
nfs-utils-1.2.3-75.el6.x86_64
rpcbind-0.2.0-13.el6_9.1.x86_64
如果没有安装,需要用yum安装。安装方法参考:搭建nfs共享存储服务之二
[root@web01 ~]# /etc/init.d/rpcbind status
rpcbind is stopped
[root@web01 ~]# /etc/init.d/rpcbind start
Starting rpcbind:                                          [  OK  ]
设置开机启动
[root@web01 ~]# chkconfig rpcbind on
[root@web01 ~]# chkconfig --list rpcbind
rpcbind         0:off   1:off   2:on    3:on    4:on    5:on    6:off
2.挂载目录。
挂载前先检查:
[root@web01 ~]# showmount -e 172.16.1.31
Export list for 172.16.1.31:
/data 172.16.1.0/24
如果shownmount出现不了结果,用telnet 172.16.1.31 111检查端口是否通,如果telnet未安装,先安装telnet
[root@web01 ~]# yum install telnet -y
确可以telnet通
[root@web01 ~]# telnet 172.16.1.31 11
Trying 172.16.1.31...
telnet: connect to address 172.16.1.31: Connection refused
shownmount有结果后,再挂载。mount -t表示类型,172.16.1.31:/data表示远端nfs服务器172.16.1.31的/data目录,/mnt表示本地nfs客户端。
[root@web01 ~]# mount -t nfs 172.16.1.31:/data /mnt
再用df -hT查看挂载是否成功。
[root@web01 ~]# df -hT
Filesystem        Type   Size  Used Avail Use% Mounted on
/dev/sda3         ext4    18G  1.5G   16G   9% /
tmpfs             tmpfs  931M     0  931M   0% /dev/shm
/dev/sda1         ext4   190M   38M  142M  22% /boot
172.16.1.31:/data nfs     18G  1.5G   16G   9% /mnt
验证:
在客户端/mnt目录下创建一个oldboy.txt文件,然后查看服务端nfs的目录/data是否存在。
如果存在说明验证成功。
总结:
本文出自 “sandshell” 博客,请务必保留此出处http://sandshell.blog.51cto.com/9055959/1954023
原文:http://sandshell.blog.51cto.com/9055959/1954023