这是我在 Fedora 32 中的 nfs 服务状态:
[dolphin@MiWiFi-R4CM-srv infrastructure]$ sudo systemctl status nfs-server.service
● nfs-server.service - NFS server and services
Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
Drop-In: /run/systemd/generator/nfs-server.service.d
└─order-with-mounts.conf
Active: active (exited) since Sun 2020-07-19 04:16:50 EDT; 2h 34min ago
Process: 599370 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 599371 ExecStart=/usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
Process: 599381 ExecStart=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi (code=exited, status=0/SUCCESS)
Main PID: 599381 (code=exited, status=0/SUCCESS)
CPU: 37ms
Jul 19 04:16:50 MiWiFi-R4CM-srv systemd[1]: Starting NFS server and services...
Jul 19 04:16:50 MiWiFi-R4CM-srv systemd[1]: Finished NFS server and services.
这是我的导出文件配置/etc/exports
:
[dolphin@MiWiFi-R4CM-srv infrastructure]$ cat /etc/exports
/home/dolphin/data/k8s/monitoring/infrastructure/jenkins *(rw,all_squash)
当我尝试使用此命令测试我的 nfs 服务时:
[dolphin@MiWiFi-R4CM-srv infrastructure]$ mount -t nfs -o v4 192.168.31.2:/home/dolphin/data/k8s/monitoring/infrastructure/jenkins /mnt
mount.nfs: failed to apply fstab options
我在网上搜索,但发现没有人遇到这种情况。哪里出了问题,我该怎么做才能解决这个问题?
[dolphin@MiWiFi-R4CM-srv infrastructure]$ showmount -e 192.168.31.2
Export list for 192.168.31.2:
/home/dolphin/data/k8s/monitoring/infrastructure/jenkins *
答案1
挂载远程文件系统需要 root 权限。因此你应该这样做sudo mount ...