nfs的一个报错:mount.nfs: Input/output error

mount.nfs: Input/output error解决:在客户端也需启动portmap顺便贴一篇文章:原贴:http://linux.chinaunix.net/bbs/archiver/?tid-905711.html

2007-8-8 14:40 wzknet

手把手教你Linux系统下快速设置NFS[color=Blue]一、NFS服务端设置(NFS服务端IP:10.10.10.10/25)操作系统版本:[root@localhost /]# cat /etc/redhat-releaseRed Hat Enterprise Linux AS release 4 (Nahant Update 4)1、检查portmap服务运行状态(因为NFS及其辅助程序都是基于RPC的,所以我们要确保系统中首先运行portmap服务)[root@localhost /]# iduid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) context=root:system_r:unconfined_t[root@localhost /]# service portmap statusportmap is stopped结果显示portmap服务是停止的,可以通过以下命令启动该服务:[root@localhost /]# service portmap startStarting portmap: [OK][root@localhost /]# service portmap statusportmap (pid 11085) is running…结果显示portmap服务已处于“running”状态。2、检查nfs服务运行状态[root@localhost /]# service nfs statusShutting down NFS mountd: rpc.mountd is stoppednfsd is stoppedrpc.rquotad is stopped结果显示nfs服务是停止的,可以通过以下命令启动该服务:[root@localhost /]# service nfs startStarting NFS services:[OK]Starting NFS quotas: [OK]Starting NFS daemon: [OK]Starting NFS mountd: [OK]此时来检查一下nfs服务运行状态,由下可知,nfs服务已启用。[root@localhost /]# service nfs statusShutting down NFS mountd: rpc.mountd (pid 11155) is running…nfsd (pid 11151 11148 11147 11146 11145 11144 11143 11142) is running…rpc.rquotad (pid 11138) is running…3、设置nfs服务在系统重启后自动运行[root@localhost /]# chkconfig –list nfsnfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off[root@localhost /]# chkconfig nfs on[root@localhost /]# chkconfig –list nfsnfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off4、/etc/exports文件设置/etc/exports文件格式:共享的目录 主机名称1或IP1(参数1,参数2) 主机名称2或IP2(参数3,参数4)如果使用主机名称,则必须预先在/etc/hosts文件中定义。exports主要参数:rw:可读写权限ro:只读权限no_root_squash:对于登陆NFS主机的共享目录用户如果是root的话则对该目录具有root权限。这样做极不安全,建议不用为好!root_squash:对于登陆NFS主机的共享目录用户使用者如果是root则它的权限将被压缩成匿名使用者,同时它的UID和GID都会变成nobody那个系统账号的身份。all_squash:不管登陆NFS主机用户身份如何,它的身份都会被压缩成匿名使用者,通常就是nobodyanonuid:anonuid=xxx,制定NFS服务器/etc/passwd中匿名用户的UIDanongid:anonuid=xxx,制定NFS服务器/etc/passwd中匿名用户的GIDsync:数据在请求时写入共享async:NFS在写入数据前可响应请求secure:NFS通过1024以下的安全端口发送insecure:NFS通过1024以上端口发送hide:不共享NFS目录的子目录no_hide:共享NFS目录的子目录例如在/etc/exports文件中添加以下内容(红色部分):[root@localhost /]# cat /etc/exports/study 10.10.10.12(rw,sync,no_root_squash)5、输出共享目录[root@localhost /]#exportfs -a查看是否成功输出共享目录:[root@localhost /]# cat /etc/exports/study 10.10.10.12(rw,sync,no_root_squash)二、NFS客户端设置(NFS客户端IP:10.10.10.12/25)[root@REDHATAS5 /]# cat /etc/redhat-releaseRed Hat Enterprise Linux Server release 5 (Tikanga)1、检查portmap运行状态(因为NFS及其辅助程序都是基于RPC的,所以我们要确保系统中首先运行portmap服务)[root@REDHATAS5 /]# service portmap statusportmap (pid 22742) is running…如果portmap服务未启,则在mount时会报错:[root@REDHATAS5 /]# mount -t nfs 10.10.10.10:/study /nfstestmount.nfs: Input/output error2、查看NFS服务端共享目录[root@REDHATAS5 /]# showmount -e 10.10.10.10Export list for 10.10.10.10:/study 10.10.10.123、挂载共享目录[root@REDHATAS5 /]# mount -t nfs 10.10.10.10:/study /nfstest4、查看成功挂载的nfs目录[root@REDHATAS5 /]# df -h | grep /nfstest10.10.10.10:/study7.8G6.8G695M91% /nfstest5、测试共享目录是否可读写[root@REDHATAS5 nfstest]# ls -ltotal 8-rw-r–r– 1 root root 21 Jun 24 13:13 nfs-server.txt[root@REDHATAS5 nfstest]# touch nfs-client.txt[root@REDHATAS5 nfstest]# ls -ltotal 12-rw-r–r– 1 root root0 Jun 24 13:13 nfs-client.txt-rw-r–r– 1 root root 21 Jun 24 13:13 nfs-server.txt由上可知,表明可读写。[/color][[i] 本帖最后由 wzknet 于 2007-8-8 14:42 编辑 [/i]]我想一个人旅行,背上简单的行囊,踏上行程,

nfs的一个报错:mount.nfs: Input/output error

相关文章:

你感兴趣的文章:

标签云: