mount nfs 经常出错信息总结(转)

通常当NFS不能正常使用时候会给出提示,一般给出一下几种:

1)mount: 192.168.1.111:/opt failed, reason given by server: Permission denied
查看配置文件exports,是否为允许挂载的客户。
2)mount: RPC: Unable to receive; errno = No route to host
首先看是否在同一网段
再者输入:
[root@localhost etc]# service iptables status
看防火墙是否开启,有则将其关闭
[root@localhost etc]# service iptables stop
3)mount: RPC: Unable to receive; errno = Connection refused
首先看nfs服务是否开启,其次看rpcbind是否开启,如果rpcbind没有运行,那在重新开启rpcbind后,要再restart nfs服务,因为重启rpcbind已对nfs的一些配置造成影响,需要restart.

没错,看到这时候,你已经找到问题了,[root@localhost etc]# service iptables stop
,然后再service nfs restart 下就可以了。

补充一些内容:

1、、、关于防火墙的操作

1、永久性关闭

lokkit --disabled
2、 即时生效,重启后失效

service 方式
开启: service iptables start

关闭: service iptables stop

iptables方式

查看防火墙状态:
/etc/init.d/iptables status

暂时关闭防火墙:
/etc/init.d/iptables stop

重启iptables:
/etc/init.d/iptables restart

 

另外是配置NFS的方法:

首先,用ifconfig将主机和开发板设置到同一网段,如主机192.168.1.107,子网掩码为255.255.255.0,开发板为192.168.1.108,子网掩码255.255.255.0
然后互相ping下,Ping的通说明网线和网卡没问题。
然后,架设nfs服务器(以下服务的开启和关闭,都可通过setup命令,进行配置)
1)在主机上启动portmap服务

    service rpcbind start
   可以用service rpcbind status 进行检查是否开启。
2)对nfs进行配置(/etc/exports)
  修改配置文件/etc/exports
  添加如下代码
   /opt  *(rw,sync,no_root_squash)
    要共享的目录   允许使用的用户,*表示允许任意用户使用,也可以使用具体的ip,如本机可用192.168.1.168,括号中rw代表可读写,sync未知,no_root_suqash意思是以root权限访问该共享文件夹。

修改完之后,输入:
[root@localhost etc]# exports -rv
使配置文件生效。   
3)在主机上启动nfs服务
   service nfs start
4)在开发板上进行挂载mount
 mount -t nfs -o nolock 192.168.1.111:/opt /mnt
提示:我们常常可以用本机挂载本机进行简单的测试。

 

 

 需要将在linux里交叉编译好的程序放在arm上运行,所以首先要将程序copy至arm上,选择了nfs。 

       但在arm上mount nfs的时候遇到了失败的情况:

       在网上查找解决方案:

        nfs mount 默认选项包括文件锁,依赖于portmap提供的动态端口分配功能。
        解决方法:kill 文件锁(lockd)或者mount -o nolock

 

        于是尝试mount -o nolock -t nfs 192.168.1.24:/home/test /mnt/nfs,正常工作。

原文地址:https://www.cnblogs.com/pengdonglin137/p/3283308.html