2025-03-16  2025-03-16    205 字  1 分钟

NFS是一种没有加密的高性能的远程挂载工具, 如果在局域网中可以直接使用, 如果在公网环境下, 可以搭配Wireguard使用

安装

NFS服务器

假设IP: 10.0.0.4

1apt install -y nfs-kernel-server

客户端

假设IP: 10.0.0.2

1apt install -y nfs-common

创建共享

编辑配置文件

1vim /etc/exports

假设10.0.0.2是允许是访问的IP(白名单IP)

1/storage 10.0.0.2(rw,sync,no_subtree_check,no_root_squash)

应用配置

1exportfs -ra
2systemctl restart nfs-server

挂载

请注意防火墙是否允许, 且NFS传输是未加密的, 如果需要加密可以搭建Wireguard

1mount -t nfs -o proto=tcp 10.0.0.4:/storage /mnt/storage

配置开机自动挂载

110.0.0.4:/storage /mnt/storage nfs defaults,_netdev,proto=tcp 0 0

除另有声明外本博客文章均采用 知识共享 (Creative Commons) 署名 4.0 国际许可协议 进行许可转载请注明原作者与文章出处