Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1345886
  • 博文数量: 206
  • 博客积分: 10571
  • 博客等级: 上将
  • 技术积分: 2610
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-30 11:50
文章分类
文章存档

2014年(1)

2013年(4)

2012年(18)

2010年(14)

2009年(31)

2008年(3)

2007年(135)

分类: LINUX

2007-05-07 20:03:15

                   NFS服务的搭建过程
                        本文档只是介绍NFS的最简单搭建过程,目的是有助于快速搭建,入门;
                        本搭建过程是基于FC5,且采用自带的SAMBA包;
                        
                        一、概念
                        
                        NFS(Network File System/网络文件系统):
                        
                        1、设置Linux系统之间的文件共享(Linux与Windows中间文件共享采用
                        SAMBA服务);
                        
                        2、NFS只是一种文件系统,本身没有传输功能,是基于RPC协议实现的,才能
                        达到两个Linux系统之间的文件目录共享;
                        
                        3、NFS为C/S架构;
                        
                        二、服务器配置
                        
                        1、配置文件
                        
                        主要配置文件为:/etc/exports
                        
                        格式为: 共享目录 可mount主机IP(参数1,参数2,……)
                        
                        如:/var/nfs
                        172.20.*.*(rw,sync,all_squash,anonuid=65534,anongid=65534)
                        
                        说明:必须注意nfs/目录的访问权限,必须设置成777权限;父目录/var权限
                        无要求,普通的755即可;
                        
                        2、启动相关服务
                        
                        然后依次启动相关服务:portmap,nfslock,nfs
                        
                        3、检查共享目录
                        
                        随后可以采用showmount –e查看一下,看看共享的目录情况:
                        
                        [root@ns var]# showmount -e
                        
                        Export list for ns.osserver:
                        
                        /var/nfs 172.20.*.*
                        
                        OK,到此为止,NFS服务器搭建完毕;
                        
                        三、客户端配置
                        
                        1、确保portmap运行
                        
                        客户端必须确保RPC协议相应的portmap正常运行,否则mount将失败;
                        
                        2、挂载/var/nfs目录(本地挂载点为/mnt/nfs)
                        
                        mount -t nfs 172.20.65.16:/var/nfs /mnt/nfs
                        
                        成功mount以后,即可同本地目录一样随意操作;
                        
                        四、其它相关命令
                        
                        1、当修改了/etc/exports文件后,可以不用重新启动nfs服务,直接采用
                        exports –rv
                        即可重新导出共享目录;
                        
                        该命令格式如下:
                        
                        exportfs [-aruv]
                        
                        -a :全部mount或者unmount /etc/exports中的内容
                        
                        -r :重新mount /etc/exports中分享出来的目录
                        
                        -u :umount 目录
                        
                        -v :在 export 的时候,将详细的信息输出到屏幕上。
                        
                        具体例子:
                        
                        [root@ns var]# showmount -e
                        
                        Export list for ns.osserver:
                        
                        /var/nfs 172.20.*.*
                        
                        [root@ns var]# exportfs –au #全部卸载
                        
                        [root@ns var]# showmount -e
                        
                        Export list for ns.osserver:
                        
                        [root@ns var]# exportfs –rv #全部重新 export 一次
                        
                        exporting 172.20.*.*:/var/nfs
                        
                        [root@ns var]#
                        
                        2、showmout命令对于NFS的操作和查错有很大的帮助,所以我们先来看一下
                        showmount的用法
                        
                        showmout
                        
                        -a :这个参数是一般在NFS SERVER上使用,是用来显示已经mount上本机
                        nfs目录的cline机器。
                        
                        -e :显示指定的NFS SERVER上export出来的目录。
                        
                        例如:
                        
                        [root@localhost ~]# showmount -e 172.20.65.16
                        
                        Export list for 172.20.65.16:
                        
                        /var/nfs 172.20.*.*
                        
                        [root@ns var]# showmount -a
                        
                        All mount points on ns.osserver:
                        
                        172.20.*.*:/var/nfs
                        五、常见问题解答
                        
                        1、提示:mount to NFS server '172.20.67.203' failed: server
                        is down.
                        
                        解决方案:可能是NFS服务器的防火墙有问题;
                        
                        2、提示:mount: RPC: Timed out
                        
                        解决方案:由于RPC协议没运行;启动portmap服务;
                        
                        也有可能是防火墙问题;Server/Client均有可能。
                       
                        原文地址:
阅读(735) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~