您的位置:首页 > 理论基础 > 计算机网络

Ubuntu+Tiny6410的网络文件系统NFS挂载

2013-04-25 21:13 465 查看
最近在Tiny6410上开发一个项目,为了方便调试,打算搭建一个nfs,主机是Ubuntu。晚上搞了很久终于成功了,记录一下先。

1.sudo apt-get install nfs-kernel-server

sudo apt-get install nfs-common

sudo apt-get install portmap (注:安装这个的时候提示的是rpcbind,好像rpcbind是portmap的更新版)

2.配置IP,Tiny6410开发板上默认的IP是192.168.1.230 ;netmask是255.255.255.0.为了方便起见,我们把自己主机上的IP改为和开发板上是在同一个网段上, 而不用再修改开发板的IP了,注务必两者在同一个网段才行的。

sudo vim /etc/network/interfaces

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet static

address 192.168.1.20

netmask 255.255.255.0

gateway 192.168.1.1

然后重启网络配置 sudo /etc/init.d/networking restart

这时先用主机和开发板互相ping一下,如果能通再进入下一步,如果还不Ping不通,试一下:ifconfig eth0 192.168.1.20 netmask 255.255.255.0 up 之后再Ping。

3.设置共享的目录的权限:

sudo chmod 777 xxx (注:xxx表示你要共享的目录,下同)

4.在/etc/exports文件中添加:

xxx *(rw,sync,no_root_squash)

*表示所有的客户机都可以挂载此目录

rw表示具有读写的权限

no_root_squash表示允许挂载此目录的客户机享有该主机的root身份

5.重启portmap和nfs-kernel-server

sudo /etc/init.d/portmap restart

sudo /etc/init.d/nfs-kernel-server restart

6.在开发板上输入命令进行挂载nfs:

mount -t nfs -o nolock 192.168.1.20:xxx /mnt

网上有些地方说用:mount -t nfs 192.168.1.20:xxx /mnt 但是我用这个时候会出现这样的错误:svc:failed to register lockdv1 RPC service(errno 111)

卸载:umount /mnt

如果当cp或者运行/mnt里的东西的时候,出现有这样的问题 : nfs: server is not responding,still trying

原因是开发板网口速度和主机网口速度不匹配。

改为:mount -t nfs -o intr,nolock,rsize=1024,wsize=1024 192.168.1.20:xxx /mnt

问题就解决了。



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: