NFS使用mount挂载无法挂载出问题后的排错思路
首先确认NFS服务端配置和服务是OK的,
在服务端使用showmount -e localhost 检查
[root@nfs-A-C64 ~]# showmount -e localhost
Export list for localhost:
/data/r_shared 192.168.221.1/24
/data/w_shared 192.168.221.1/24
2.确认NFS客户端showmount是否OK
[root@Centos64-131-client ~]# showmount -e 192.168.221.130
mount clntudp_create: RPC: Port mapper failure - RPC: Unable toreceive
如果出现以上问题的解决思路:
a. ping NFS服务器的IP,看网络是不是通的
[root@Centos64-131-client ~]# ping 192.168.221.130
PING 192.168.221.130 (192.168.221.130) 56(84) bytes of data.
64 bytes from 192.168.221.130: icmp_seq=1 ttl=64 time=0.352 ms
64 bytes from 192.168.221.130: icmp_seq=2 ttl=64 time=0.647 ms
64 bytes from 192.168.221.130: icmp_seq=3 ttl=64 time=0.192 ms
b. 通过111端口telnet一下NFS服务器192.168.1.111看能不能连上
[root@nfs-C-C58 w_dingjian]# telnet 192.168.1.111 111
Trying 192.168.1.111...
telnet: connect to address 192.168.1.111: No route to host
telnet: Unable to connect to remote host: No route to host
如果出现这情况,我们凭经验可以告诉我们可能是服务端的iptables或者SELINUX问题,
我们把NFS服务端的iptables或者SELINUX关掉,
★.关闭selinux
修改配置文件需要重启机器:
修改/etc/selinux/config 文件
vim /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled
或者:
sed -i's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config #修改配置文件永久生效,但必须重启系统
★关闭防火墙iptables
[root@nfs-A-C64 ~]# /etc/init.d/iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
[root@nfs-A-C64 ~]# /etc/init.d/iptablesstatus
Firewall is stopped.
3.再在客户端用showmount 一下服务器
[root@Centos64-131-client ~]# showmount -e 192.168.221.130
Export list for 192.168.221.130:
/data/r_shared 192.168.221.1/24
/data/w_shared 192.168.221.1/24
现在返回到NFS服务器共享目录的信息,就OK了,现在就可以挂载了
4.使用mount -t对其进行挂载
[root@Centos64-131-client ~]# mount -t nfs192.168.221.130:/data/bbs /mnt
[root@Centos64-131-client ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda3 17981340 2124800 14928388 13% /
/dev/sda1 295561 16842 263459 7% /boot
tmpfs 60136 0 60136 0% /dev/shm
192.168.221.130:/data/bbs
17981344 2100176 14953008 13% /mnt
提示:在刚学习linux的时候,建议把iptables和SELINUX关闭,