免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 6282 | 回复: 14
打印 上一主题 下一主题

nfs做server和做client的用法,我都测试过,没有问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2002-08-22 20:16 |只看该作者 |倒序浏览
[这个贴子最后由南非蜘蛛在 2002/12/17 07:30pm 编辑]

nfs的用法,因为我经常用,所有就总结出来了,希望对你有帮助

freebsd和solaris的我都用过,互相mount和share都没有问题,linux我没有用过,谁用过就贴出来吧


作者:南非蜘蛛 zhedou@sohu.com
个人主页:http://www.douzhe.com
转载请保留作者信息

(一)solaris


做server

1:基本运行程序是/etc/init.d/rpc和/etc/init.d/nfs.server

启动服务
/etc/rc3.d/S15nfs.server start

S15nfs.server包含了rpc和nfs.server,还有日志等一些其它有用的程序.建议用S15nfs.server启动nfs的server端

要是想每次从起后都运行,保证S15nfs.server在/etc/rc3.d目录下

2:共享目录
vi /etc/dfs/dfstab文件中有共享条目,这些共享目录会在守护进程启动时自动共享。
这些进程在系统进入运行级别2时自动运行。
挂接远程网络文件系统  
# share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2
例如:share -F nfs -o ro=202.108.42.90:202.108.42.91  /home2
     share -F nfs -o ro=@202.108.42.0/24  /home2

-o specific_options
       The specific_options are used to control access of the
       shared  resource.   (See   share_nfs(1M)  for  the NFS
       specific options.) They may be any of the following:

       rw    pathname is shared read/write  to  all  clients.
             This is also the default behavior.

       rw=client[]...  或一个网段 rw=@202.108.42.0/24
             pathname is shared read/write only to the listed
             clients. No other systems can access pathname.

       ro    pathname is shared read-only to all clients.

       ro=client[]...  或一个网段 rw=@202.108.42.0/24
             pathname is shared read-only only to the  listed
             clients.   No other systems can access pathname.

-d description
       The -d flag may be used to provide  a  description  of
       the resource being shared.
dfshares命令  
用以查看服务器的共享资源

dfmounts命令  
服务器上查看共享资源被利用的状况

用nfsstat看nfs的全部状态



做client

1:基本运行程序是/usr/lib/nfs/statd和/usr/lib/nfs/lockd

启动服务
/etc/rc3.d/S73nfs.client start

S73nfs.lient包含了statd和lockd,还有日志等一些其它有用的程序.建议用S73nfs.client启动nfs的client端

要是想每次从起后都运行,保证S73nfs.client在/etc/rc2.d目录下



(二)freebsd


做server,系统至少要运行nfsd和mountd守护进程,一运行nfsd,mountd会自动运行

1: vi /etc/rc.conf
   portmap_enable="YES"
   nfs_server_enable="YES"
   mountd_flags="-r"      (mountd runs automatically whenever the NFS server is enabled.)

2: 设置共享目录
# cat /etc/exports
/home/tommy -ro -maproot=root -network 202.108.44.0

目录的访问限制中具有多种选项,这些选项对于保证NFS的安全性相当重要。

  -ro---以只读形式输出文件系统,远程客户只能读不能写这个目录
  -maproot---将客户机上的root用户映射为服务器中的某个用户和族,也可以使用UID 和GID的形式,如maproot=root,maproot=10,或maproot=10:1。这个设置选项可以用来保护服务器上的文件系统不被客户中的使用者非法访问。
  -mapall---将客户上的所有用户都映射为本机的某个用户,使用形式与maproot相同。它同样也是用于保护服务器文件系统的安全性的。
  -alldirs---允许安装该目录下的所有子目录。
  -network---允许一定网络上的计算机可以装载这个文件系统。
  -mask---用于修订 network中的网络号使用的缺省掩码,可定义对网络的一部分开放文件系统。

  当更改了exports文件之后,需要向mountd发送SIGHUP信号,使其重读exports文件的内容。

要是改变了共享目录,就要运行
# kill -HUP `cat /var/run/mountd.pid`

查看共享目录
# showmount -e ip


做client

     vi /etc/rc.conf:
     nfs_client_enable="YES"


(三)linux


做server

控制网络文件系统输出的配置文件是/etc/exports。它的格式是:

directory       hostname(options)

其中(options)是可选的。举个例子:
/mnt/export     speedy.redhat.com

将允许主机speedy.redhat.com安装/mnt/export 而

/mnt/export     speedy.redhat.com(ro)

则仅仅允许speedy以只读方式安装/mnt/export。

每当您改变了/etc/exports,您需要告诉NFS进程重新检查配置信息。一个简单的方法是 停下再启动该服务器进程:

/etc/rc.d/init.d/nfs stop
/etc/rc.d/init.d/nfs start

还有一种方法:

killall -HUP rpc.nfsd rpc.mountd

请查看nfsd(8),mountd(8) 和exports(5)的man 手册以获得详细信息 。


做client

论坛徽章:
0
2 [报告]
发表于 2002-08-22 21:28 |只看该作者

nfs做server和做client的用法,我都测试过,没有问题

In solaris the startup scripts for level 3 can not be under

/etc/rc3.d/backup/

it should be /etc/rc3.d/

论坛徽章:
0
3 [报告]
发表于 2002-08-22 23:24 |只看该作者

nfs做server和做client的用法,我都测试过,没有问题

好东西  我喜欢 斑竹辛苦

论坛徽章:
0
4 [报告]
发表于 2002-08-23 08:11 |只看该作者

nfs做server和做client的用法,我都测试过,没有问题

這是蜘蛛的見面禮吧.

论坛徽章:
0
5 [报告]
发表于 2002-08-23 08:28 |只看该作者

nfs做server和做client的用法,我都测试过,没有问题

第一次看到蜘蛛写东西。我个人认为很好,很实用。使哪些对UNIX似懂非懂的人可以上一个台阶。

论坛徽章:
0
6 [报告]
发表于 2002-08-23 08:44 |只看该作者

nfs做server和做client的用法,我都测试过,没有问题

置顶。

论坛徽章:
0
7 [报告]
发表于 2002-08-23 09:45 |只看该作者

nfs做server和做client的用法,我都测试过,没有问题

真是好人,我正需要这方面的东西呢,谢谢啦!

论坛徽章:
0
8 [报告]
发表于 2002-08-23 11:40 |只看该作者

nfs做server和做client的用法,我都测试过,没有问题

下面引用由cybermoon2002/08/22 09:28pm 发表的内容:
In solaris the startup scripts for level 3 can not be under
/etc/rc3.d/backup/
it should be /etc/rc3.d/
不好意思,是写错了,因为我把rc3.d没有用的东西都放到/etc/rc3.d/backup下了,所以就顺手贴上了,应该是在 /etc/rc3.d下

论坛徽章:
0
9 [报告]
发表于 2002-09-06 14:39 |只看该作者

nfs做server和做client的用法,我都测试过,没有问题

我又上了一个台阶,呵呵

论坛徽章:
0
10 [报告]
发表于 2002-09-06 14:41 |只看该作者

nfs做server和做client的用法,我都测试过,没有问题

下面引用由amiao2002/09/06 02:39pm 发表的内容:
我又上了一个台阶,呵呵
你都已经那么厉害了,还要上台阶呀:)
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP