您的位置:首页 > 运维架构 > Linux

linux的nfs文件共享

2015-08-05 23:11 477 查看
a. 安装nfs服务
#apt-get install nfs-common nfs-kernel-server portmap
其中portmap可能被替换了,会提示selecting 'rpcbind' instead of 'portmap'
所以你检查有没安装rpcbind,不用安装portmap了。

b. 配置nfs服务
#vim /etc/exports
在最后添加上
/nfs/ 192.168.1.*(rw,sync,no_root_squash)
/nfs : 共享目录
192.168.1.*   :  可以访问这个服务器共享目录的机器
rw,sync,no_root_squash:代表各种属性

c. 重启服务
# /etc/init.d/nfs-kernel-server restart
要先开启portmap服务

d. 使用nfs服务
mount -t nfs -o nolock 192.168.1.100:/a/ /b/

-t vfstype 指定文件系统的类型,通常不必指定。mount 会自动选择正确的类型。
-o nolock。参考http://blog.csdn.net/yhcao0804/article/details/6870296
df -h可以查看有挂载成功,
也可以umount a/看会不会提示没有挂载到,因为没挂载怎么卸载
开发板和虚拟机不通时,例如mount时连接失败,先让2台机器ping通一下,再mount

参考: http://www.cnblogs.com/mchina/archive/2013/01/03/2840040.html http://blog.sina.com.cn/s/blog_7bd0d88201011qtm.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: