手机版
你好,游客 登录 注册
背景:
阅读新闻

Linux下资源共享之NFS服务的搭建

[日期:2012-10-17] 来源:Linux社区  作者:gjp0731 [字体:大 中 小]

服务器上配置:

[root@gjp99 public]# mkdir /gjp
[root@gjp99 public]# cat /etc/exports
/public 192.168.10.0/24(ro)
/gjp    192.168.10.0/24(rw,sync)  //增加此行

注意:子网掩码后面不能有空格!

[root@gjp99 public]# ll -d /gjp
drwxr-xr-x 2 root root 4096 Aug  3 18:12 /gjp
[root@gjp99 public]# chmod o+wt /gjp

[root@gjp99 ~]# ll -d /gjp
drwxr-xrwt 2 root root 4096 Oct 15 10:32 /gjp

[root@gjp99 ~]# exportfs -rv
exporting 192.168.10.0/24:/public
exporting 192.168.10.0/24:/gjp

客户端上:

[root@mail ~]# mkdir /mnt/gjp
[root@mail ~]# mount 192.168.10.99:/gjp /mnt/gjp
[root@mail ~]# mount
/dev/sda2 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.10.99:/gjp on /mnt/gjp type nfs (rw,addr=192.168.10.99)
[root@mail ~]# cd /mnt/gjp

[root@mail gjp]# ll
total 0
[root@mail gjp]# touch gjp

[root@mail gjp]# ll
total 0
-rw-r--r-- 1 nfsnobody nfsnobody 0 Oct 15  2012 gjp

服务器上:

man exports

 

[root@gjp99 ~]# vim /etc/exports

/public 192.168.10.0/24(ro)
/gjp    192.168.10.0/24(rw,no_root_squash,sync)增加参数:取消映射关系

[root@gjp99 ~]# service nfs restart
Shutting down NFS mountd:                                  [  OK  ]
Shutting down NFS daemon:                                  [  OK  ]
Shutting down NFS quotas:                                  [  OK  ]
Shutting down NFS services:                                [  OK  ]
Starting NFS services:                                    [  OK  ]
Starting NFS quotas:                                      [  OK  ]
Starting NFS daemon:                                      [  OK  ]
Starting NFS mountd:                                      [  OK  ]
[root@gjp99 ~]# service autofs restart
Stopping automount:                                        [  OK  ]

Starting automount:                                        [  OK  ]

linux
相关资讯       NFS  Linux NFS配置  Linux NFS安装  Linux NFS服务 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款