linux的nfs文件共享

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值