现在的位置: 首页 > 综合 > 正文

nfs mount 设置文件服务器

2018年04月07日 ⁄ 综合 ⁄ 共 1266字 ⁄ 字号 评论关闭

1. server 端

例如可以编辑/etc/exports为:
/tmp     *(rw,no_root_squash)
/home/public 192.168.0.*(rw)   *(ro)
/home/test  192.168.0.100(rw)
/home/linux  *.the9.com(rw,all_squash,anonuid=40,anongid=40)
设定好后可以使用以下命令启动NFS:
/etc/rc.d/init.d/portmap start (在REDHAT中PORTMAP是默认启动的)
/etc/rc.d/init.d/nfs start

exportfs命令:
如果我们在启动了NFS之后又修改了/etc/exports,是不是还要重新启动nfs呢?这个时候我们就可以用exportfs命令来使改动立刻生效,该命令格式如下:
exportfs [-aruv]
-a :全部mount或者unmount /etc/exports中的内容
-r :重新mount /etc/exports中分享出来的目录
-u :umount 目录
-v :在 export 的?r候,将详细的信息输出到屏幕上。
具体例子:
[root @test root]# exportfs -rv <==全部重新 export 一次!
exporting 192.168.0.100:/home/test
exporting 192.168.0.*:/home/public
exporting *.the9.com:/home/linux
exporting *:/home/public
exporting *:/tmp
reexporting 192.168.0.100:/home/test to kernel

exportfs -au <==全部都卸载了。

2. client

客户段的操作:
1、showmout命令对于NFS的操作和查错有很大的帮助,所以我们先来看一下showmount的用法
showmout
-a :这个参数是一般在NFS SERVER上使用,是用来显示已经mount上本机nfs目录的cline机器。
-e :显示指定的NFS SERVER上export出来的目录。
例如:
showmount -e 192.168.0.30
Export list for localhost:
/tmp *
/home/linux *.linux.org
/home/public (everyone)
/home/test 192.168.0.100
2、mount nfs目录的方法:
mount -t nfs hostname(orIP):/directory /mount/point
具体例子:
Linux: mount -t nfs 192.168.0.1:/tmp /mnt/nfs
Solaris:mount -F nfs 192.168.0.1:/tmp /mnt/nfs
BSD: mount 192.168.0.1:/tmp /mnt/nfs

 

可以用两三个web服务器 来共享一个文件服务器 .

 

引用 (http://blog.sina.com.cn/u/54c5f9c501000a40)

抱歉!评论已关闭.