Widora-NEO NFS网络文件共享
-
在widora-neo上应用了一下NFS共享,将过程和经验分享如下:
widora-neo映射远程文件夹到widora-neo本地
首先,服务器端和客户端的 widora-neo都安装有带fs-nfs系统的固件,在编译固件时选中nfs支持即可。1. 作为服务器的widora (192.168.3.10)配置:
1.1 编辑/ect/exports 内容如下:
/tmp 192.168.3.13(fsid=0,rw,no_root_squash,no_subtree_check,sync)说明:
a. tmp是你要共享的本地文件夹;
b. 192.168.3.13是授权共享的客户端IP;
c. 如果有多个共享客户,可以再起一行。
d. **好像只有/tmp下文件夹是可以共享的,设置其他文件系统的共享文件夹会失败。???? **1.2. 依次执行:
~root@Widora:/etc/init.d/exportfs -r
~root@Widora:/etc/init.d/rpcd restart
~root@Widora:/etc/init.d/nfsd restart
有时会出现 mount: can't setup loop device: No such file or directory提示,不用管它.2. 作为客户的widora (192.168.3.13) 配置:
2.1 在 /mnt 建立子目录 netdir
2.1 然后挂载nfs:
mount -t nfs 192.168.3.10:/tmp /mnt/netdir3. 最后可以在rc.local或rc.d中设置开机自动挂载.
-
映射远程RPi 文件夹到widora-neo本地
-
在raspiberry-pi 上安装:
sudo apt-get install portmap
sudo apt-get install nfs-kernel-server -
在raspiberry-pi 下建立/home/netshare 权限设置 777
在widora下建立 /netdir 权限设置 777 -
编辑 sudo nano /etc/exports 为以下内容:
/home/netshare 192.168.3.10(rw,sync,no_root_squash,no_subtree_check)
#如果修改了/etc/exports文件后不需要重新激活nfs,只要重新扫描一次/etc/exports文件,并且重新将设定加载即可 -
修改 sudo nano /etc/hosts (好像不是必须的??)
最下增加一行,Widora为client机的hostname:
162.168.3.10 Widora -
启动服务
sudo /etc/init.d/rpcbind start
sudo /etc/init.d/nfs-kernel-server start -
全部挂载(或卸载)/etc/exports文件内的设定: sudo exportfs -var
参数说明如下。
(1)-a:全部挂载(或卸载)/etc/exports文件内的设定。
(2)-r:重新挂载/etc/exports中的设置,此外同步更新/etc/exports及/var/lib/nfs/xtab中的内容。
(3)-u:卸载某一目录。
(4)-v:在export时将共享的目录显示在屏幕上。
设置完成后可以 showmount -e 看看是否启动
接着可以在server本地先 mount 一下 看看 -
widora的客户端刷带fs-nfs的固件系统,或单独安装 opkg install nfs-utils。
-
挂载nfs:
mount -t nfs 192.168.3.109:home/netshare /netdir
192.168.3.109为RPI的IP
-