ubuntu NFS配置
(1)nfs 安装
apt-get install nfs-kernel-server
(2)
编辑/etc/exports
/home/arm/nfsroot *(insecure,rw,async,no_root_squash)
(3)
关掉防火墙
sudo iptables -F
刚关闭防火墙一定要执行(4)
(4)
重启nfs
sudo /etc/init.d/nfs-kernel-server restart
sudo /etc/init.d/portmap restart
(5)
在本机上测试
sudo mount 192.168.17.3:/home/arm/nfsroot /mnt
(6)
开发板上挂载的命令
sudo mount -t nfs 192.168.17.3:/home/arm/nfsroot -o nolock
附录
根据上述观点,造成NFS没有回应的原因有3个,分别为 网络拥塞、服务器过载和网卡丢包。
在我们的实验系统中,嵌入式系统和宿主机是直连的,而且服务器的基本处于空载的情形,所以不应该是前面 两种情况,所以很可能是嵌入式系统网卡丢包严重引起的。
在目标机器中,用ifconfig看了一下,确实丢包比较严重。很可能就 是这个问题了。
另一个意外的发现是,在查询丢包是,用tcpdump观察到nfs使用的是UDP协议。于是猜想,用TCP会不会 有所改善?
接着就是另一个问题,如何在nfs作为根文件系统时,指定nfs挂载的参数?
带着问题,跟踪了 fs/nfs/nfsroot.c的代码,发现在nfs作为根文件系统时,参数可以直接写在“nfsroot=”后面,每个参数用逗号隔开,如:
nfsroot=192.168.10.1:/rootfs,proto=tcp,nfsvers=3,nolock
这 样就可以指定nfs使用tcp协议。
重启后发现,竟然不再出现not responding的错误,一切感觉较为正常。
不 过,cs8900a丢包现象依然存在。所以,使用tcp只是一个可行的解决办法,但最终还得解决网卡的丢包问题。
我在 arm上通过NFS共享文件时出现下面的错误提示
nfs:server is not responding,still trying
原 因分析:NFS 的默认传输协议是 UDP,而PC机与嵌入式系统通过UPD交互时就会出现严重的网卡丢包现象。
解决方法:在客户端改 用TCP协议,使用下面的命令,
#mount -t nfs -o nolock -o tcp 192.168.1.161:/opt /opt
问题三 NFS:server not responing ,still trying
文章出 处:http://www.diybl.com/course/6_system/linux/Linuxjs/2008716/133207.html
在 目标板上通过NFS复制PC机上较大文件到目标板上的时候遇到的问题:
nfs: server *** not responding, still trying
修改方法:
nfs mount时候出现的NFS崩溃,按照以下的方式mount
mount -t nfs -o intr,nolock,rsize=1024,wsize=1024 192.168.1.3/root/somedir /client
问题原因:
Mandag 27 november 2006 20:12 skrev Verner Kjærsgaard:
> Mandag 27 november 2006 19:33 skrev John P. New:
> > Verner,
> >
> > This is a problem with NFS and 2.6 kernels, fast server NICs and
> > comparatively slower client NICs. This will show up when the server has
> > a 1000Mb card and the client a 100Mb, or when the server has a 100Mb
> > card and the client a 10Mb.
> >
> > Essentially, you have to pass some options to the kernel on terminal
> > boot, and this varies depending on whether you are using etherboot or
> > PXE.
> >
> > See
> > http://wiki.ltsp.org/twiki/bin/view/Ltsp/NFS#NFS_Server_not_responding
> > for a deeper explanation of the problem and the cure.
//注:原因是 server机和目标机网卡传输速率冲突,使得目标机需要大量时间复制大量数据包,其实如果目标机的网卡速率够大,则不用分那么多包,也不会冲突。
附 问题四:在测试时,“./progressbar -qws”后出现如Q3一样的提示 ,按Q3来处理。
以上参考了一些 “ 快乐的天空”的经验,他的网页是:
http://blog.chinaunix.net/u2/67519/showart_677885.html
他 的
mount -t nfs -o intr,nolock,rsize=1024,wsize=1024 192.168.1.3/root/somedir /host
应该改成
mount -t nfs -o intr,nolock,rsize=1024,wsize=1024 192.168.1.3/root/somedir /client
文 章出处:http://www.diybl.com/course/6_system/linux/Linuxjs/2008716/133207.html