1 安装NFS
NFS 即网络文件系统(Network File-System),可以通过网络让不同机器、不同系统之间可以实现文件共享。通过
NFS,可以访问远程共享目录,就像访问本地磁盘一样。NFS 只是一种文件系统,本身并没有传输功能,是基于
RPC(远程过程调用)协议实现的,采用 C/S 架构。
sudo apt-get install nfs-kernel-server # 安装 NFS服务器端
sudo apt-get install nfs-common # 安装 NFS客户端
2 添加 NFS 共享目录(在服务器)
sudo vim /etc/exports
example:
/home/jeffrey/360/360_C++_dev *(rw,sync,no_root_squash,no_subtree_check)
/home/jeffrey/360/external *(rw,sync,no_root_squash,no_subtree_check)
##Project/rknn/external monitor-2(rw,sync,no_root_squash,no_subtree_check)
~~
/home/jeffrey/360/external *(rw,sync,no_root_squash,no_subtree_check)
若需要把 “/nfsroot” 目录设置为 NFS 共享目录,请在该文件末尾添加下面的一行:
/nfsroot *(rw,sync,no_root_squash) # * 表示允许任何网段 IP 的系统访问该 NFS 目录 新建“/nfsroot”目录,并为该目录设置最宽松的权限:
sudo mkdir /nfsroot sudo chmod -R 777 /nfsroot
sudo chown ipual:ipual /nfsroot/ -R # ipual 为当前用户,-R
~~
3 启动 NFS 服务(在服务器)
查看nfs 有没有安装好
rpcinfo -p localhost
sudo /etc/init.d/nfs-kernel-server start 或者
sudo /etc/init.d/nfs-kernel-server restart
4 测试 NFS 服务器
telnet monitor-2
mount -o remount,rw /algorithm
mkdir /alogrithm/test
mount -t nfs 192.168.100.124:/home/jeffrey/360/360_C++_dev /mnt/system2/xfx/ -o nolock
/mount -t nfs -o nolock 192.168.50.124:**/Project/rknn/external/ /algorithm/test/
/mount -t nfs -o nolock 192.168.100.124:/home/jeffrey/360/external/ /mnt/system2/xfx/
umount -f /mnt/system2/xfx
一个例子
sudo /etc/init.d/nfs-kernel-server restart
mount -o remount,rw /dev/block/by-name/algorithm
mount -t nfs 192.168.100.124:/home/jeffrey/360/360_C++_dev /mnt/system2/xfx/ -o nolock