A-以ubuntu为例,其他系统请自行百度指令差异
这里假设:
服务端指要共享文件的主机,客户端指要挂载NFS共享的主机
服务端IP为A.B.C.D,客户端IP为a.b.c.d,具体到hosthatch,这里指的就是内网IP
服务端要共享的路径是"/path/to/share/dir",客户端挂载到"/path/to/mount",各种路径据实际情况修改。
服务端:
安装NFSv4服务端:
sudo apt-get install nfs-kernel-server
创建导出目录:
sudo mkdir /path/to/export && sudo mkdir /path/to/export/subdir
绑定真实目录:
sudo mount --bind /path/to/share/dir /path/to/export/subdir
设置开机自动绑定:
sudo echo "/path/to/share/dir /path/to/export/subdir none bind 0 0" >> /etc/fstab
设置导出规则:
sudo echo "/path/to/export a.b.c.d(rw,fsid=0,no_subtree_check,no_root_squash,sync)" >> /etc/exports
sudo echo "/path/to/export/subdir a.b.c.d(rw,nohide,insecure,no_subtree_check,no_root_squash,sync)" >> /etc/exports
重启服务:
sudo service nfs-kernel-server restart
客户端:
安装NFSv4客户端:
sudo apt-get install nfs-common
挂载共享(子)目录:
sudo mount -t nfs4 -o proto=tcp,port=2049 A.B.C.D:/subdir /path/to/mount
设置开机自动挂载:
sudo echo "A.B.C.D:/subdir /path/to/mount nfs4 _netdev,auto 0 0" >> /etc/fstab
B-NFS挂载
第一种方案测试成功。
hosthatch要先开工单获得内网IP;
系统为debian9 x64
debian安装Curl方法: apt-get update -y && apt-get install curl -y
一、 vps 使用 NFS 挂载大盘鸡
参考链接:https://znov.org/notes/17.html
服务端A(250G大盘鸡):
193.29.x.x Primary
Gateway: x.x.x.x
Netmask:x.x.x.x
10.x.x.10 Internal
Netmask: x.x.x.x
客户端B(nvme):
193.29.m.m Primary
Gateway: m.m.m.m
Netmask: m.m.m.m
m.1.m.1 Internal
Netmask: 2.0.0.0
https://znov.org/notes/17.html
https://github.com/Aniverse/inexistence
VPS 使用 NFS 挂载大盘鸡: /home为共享文件夹,可自己定义; /mnt为挂载位置,可自定义
步骤一:服务端A(大盘鸡)
1. 安装:apt update && apt install nfs-kernel-server
2. 配置:nano /etc/exports 添加 /home m.1.m.1(rw,no_root_squash,no_subtree_check,sync)
3. 在服务端上重启 :systemctl restart nfs-server.service
步骤二:客户端B(nvme)
4. 客户端B(nvme)安装:apt update && apt install nfs-kernel-server
5. 客户端B(nvme)挂载:mount -t nfs 10.x.x.10:/home /mnt
6. 开机挂载方式:nano /etc/fstab 添加 10.x.x.10:/home /mnt nfs rsize=8192,ize=8192,timeo=14,_netdev 0 0
7. 安装PT一键脚本(qB,Tr,RClone,Flexget)
8. qb/tr修改下载目录为/mnt/
https://www.freehao123.com/linux-gongxiang-nfs-guazai-glusterfs-s/
这里提供了NFS和Samba挂载教程,有兴趣的可以看下




文章评论