问题:我有一个 NFS 服务器无法在启动时导出目录。启动后,我可以通过 ssh 登录并手动启动服务器。我已将所有 owner:group 和权限设置为非常“宽松”,以避免任何权限问题,当我解决问题时,这些将在稍后锁定。
注意:无法从我的局域网外部访问此服务器。
systemctl status nfs-kernel-server.service 的输出
● nfs-server.service - NFS server and services
Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2023-02-20 10:22:36 GMT; 27min ago
Process: 303 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=1/FAILURE)
Feb 20 10:22:36 file-server systemd[1]: Starting NFS server and services...
Feb 20 10:22:36 file-server exportfs[303]: exportfs: Failed to stat /shared/Documents: No such file or directory
Feb 20 10:22:36 file-server exportfs[303]: exportfs: Failed to stat /shared/Downloads: No such file or directory
Feb 20 10:22:36 file-server exportfs[303]: exportfs: Failed to stat /shared/Video: No such file or directory
Feb 20 10:22:36 file-server systemd[1]: nfs-server.service: Control process exited, code=exited status=1
Feb 20 10:22:36 file-server systemd[1]: Failed to start NFS server and services.
Feb 20 10:22:36 file-server systemd[1]: nfs-server.service: Unit entered failed state.
Feb 20 10:22:36 file-server systemd[1]: nfs-server.service: Failed with result 'exit-code'.
在我运行 systemctl start nfs-kernel-server.service 之后
systemctl status nfs-kernel-server.service 的输出
● nfs-server.service - NFS server and services
Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
Active: active (exited) since Mon 2023-02-20 10:51:34 GMT; 1min 4s ago
Process: 735 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Process: 732 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Main PID: 735 (code=exited, status=0/SUCCESS)
Feb 20 10:51:33 file-server systemd[1]: Starting NFS server and services...
Feb 20 10:51:34 file-server systemd[1]: Started NFS server and services.
所以我可以手动启动该服务,但它不会在开机时启动。
服务器信息:
IP 地址 - 192.168.1.200(由 DHCP 分配,在路由器上保留 IP)
sda ext4 在启动时挂载为 / 和 swap
sdb ext4 在启动时挂载为 /shared
/etc/fstab
#sda1
UUID=4c5189b4-6ed8-416a-9b45-d7a8cb7d1f76 / ext4 errors=remount-ro 0 1
#sda2
UUID=85704cdf-46ff-4a71-83a0-deebf37f9f82 none swap sw 0 0
#sdb1
UUID=98c91985-fe1b-43d0-8c62-a6edb9184a35 /shared ext4 nofail,sync,auto,noexec,nosuid,rw,nouser 1 2
/etc/出口
/shared/Video 192.168.1.0/24(rw,sync,no_subtree_check)
/shared/Downloads 192.168.1.0/24(rw,sync,no_subtree_check)
/shared/Documents 192.168.1.0/24(rw,sync,no_subtree_check)
安装点的所有者/权限(/共享)
drwxrwxrwx 7 nobody nogroup 4096 Aug 18 2022 /shared/
/shared/* 的所有者/权限
drwxrwxrwx 27 nobody nogroup 12288 Jan 26 19:45 /shared/Documents/
drwxrwxrwx 25 nobody nogroup 4096 Aug 18 2022 /shared/Downloads/
drwx------ 2 root root 16384 Aug 18 2022 /shared/lost+found/
drwxrwxrwx 162 nobody nogroup 12288 Feb 4 15:03 /shared/Video/
(显然 lost+found 不是共享的。所有者:组和权限是递归设置的)
我可以提供所要求的任何其他信息。