第一部分在ubuntu环境下安装nfs服务环境
1、安装nfs-kernel-server
sudo apt-get install nfs-kernel-server
2、修改NFS的配置vi /etc/exports
在exports文件中添加如下信息
/nfs-server/ * (rw,sync,no_subtree_check)
挂载/nfs-server/ 目录
·
3、重启nfs服务器
sudo /etc/init.d/nfs-kernel-server restart
4、测试nfs服务器
mount -t nfs localhost:/rootfs /mnt
第二部分 目标板的配置
1、连接好目标板的网线,设置网络参数(和主机在同一网段)
ifconfig eth0 192.168.1.100(通过ping 192.168.1.1测试一下)
2、挂载nfs
mount -t nfs 192.168.1.101:/nfs /mnt(目标板目录)
挂载时,出现如下错误
[root@FORLINX6410]# mount -t nfs 192.168.1.114:/nfs /mnt
svc: failed to register lockdv1 RPC service (errno 111).
lockd_up: makesock failed, error=-111
mount: mounting 192.168.1.114:/nfs on /mnt failed: Connection refused
解决办法:(加一个 -o nolock 参数)
mount -o nolock -t nfs 192.168.1.114:/nfs /mnt
通过加 -o nolock参数,挂接是成功了,但是速度很慢,
解决办法如下:
mount -t nfs -o nolock,rsize=512,wsize=512,timeo=5 192.168.1.129:/nfsboot /mnt
设置读写块的大小,超时时间
这样nfs使用起来就很正常了