使用nfs经验谈

一、场景:

在Linux上操作命令:

host3:/opt/oracle # id
uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
host3:/opt/oracle # mount -t nfs 192.168.1.73:/opt/oracle/backup    /opt/oracle/backup
mount server reported tcp not available, falling back to udp
mount: RPC:程序未注册
host3:/opt/oracle #


二、分析步骤:

第1步:检查对方服务器是否做了连接限制

         登录到对方服务器 , 查看/etc/hosts.allow 和 /etc/hosts.deny 文件.其中hosts.deny 是拒绝了其中对应IP的主机的连接,hosts.allow 是允许其中对应IP主机的连接。

[root@hua73 ~]# tail /etc/hosts.allow
#
# hosts.allow   This file describes the names of the hosts which are
#               allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#


[root@hua73 ~]# tail /etc/hosts.deny
#
# hosts.deny    This file describes the names of the hosts which are
#               *not* allowed to use the local INET services, as decided
#               by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!

从里面内容可知,对方服务并未对他方主机的连接做任何限制。

第2步:是否是由相关服务未启动导致:


检查portmap服务、nfs服务。其中portmap服务是用来支持RPC连接,RPC被用于NFS以及NIS 等服务。

1、检查portmap服务的状态:
[root@hua73 ~]# service portmap status
portmap (pid 3285) is running...

     说明portmap服务正常启动运行。

2、检查nfs服务的状态:

[root@hua73 ~]# service nfs status
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped

      ——nfs服务未启动。


三、解决方法:

1、启动nfs服务:

[root@hua73 ~]# service nfs start
Starting NFS services:  [  OK  ]
Starting NFS quotas: [  OK  ]
Starting NFS daemon: [  OK  ]
Starting NFS mountd: [  OK  ]


2、重启portmap服务:

[root@hua73 ~]#
[root@hua73 ~]# service portmap reload
Stopping portmap: [  OK  ]
Starting portmap: [  OK  ]
[root@hua73 ~]#

但执行命令还是不行:
host3:/opt/oracle # mount -t nfs 192.168.1.73:/opt/oracle/backup    /opt/oracle/backup
mount: 192.168.1.73:/opt/oracle/backup failed, reason given by server: Permission denied

最后在exports中增加一行才解决问题
[root@hua73 etc]# vi exports

/opt/oracle/backup  192.168.1.53(rw,root_squash,sync)
~
~
~
~
~
~
~
"exports" 1L, 53C written
[root@hua73 etc]# service iptables status
Firewall is stopped.
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]# servicd nfs  restart
-bash: servicd: command not found
[root@hua73 etc]# service nfs restart
Shutting down NFS mountd: [  OK  ]
Shutting down NFS daemon: [  OK  ]
Shutting down NFS quotas: [  OK  ]
Shutting down NFS services:  [FAILED]
Starting NFS services:  [  OK  ]
Starting NFS quotas: [  OK  ]
Starting NFS daemon: [  OK  ]
Starting NFS mountd: [  OK  ]
[root@hua73 etc]# cat exports
/opt/oracle/backup  192.168.1.53(rw,root_squash,sync)
[root@hua73 etc]# ls -l exports
-rw-r--r-- 1 root root 53 Dec 12 10:44 exports
[root@hua73 etc]# date
Thu Dec 12 10:55:27 CST 2013
[root@hua73 etc]#


 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26870952/viewspace-1063358/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26870952/viewspace-1063358/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值