systemd 挂载NFS 报“Where= setting doesn't match unit name. Refusing”
NFS 客户端挂载NFS服务器我们准备使用systemd去管理--不使用/etc/fstab
里面写内容的传统方式。
systemd 的挂载内容如下:
- /etc/systemd/system/pcap.mount
[Unit]
Description=Wangdi Firewall Package capture
After=network.target
[Mount]
What=sc-cd-ct-nfsser.wd.local:/nfs
Where=/data/logs/pcap
Type=nfs
Options=_netdev,noatime,nodiratime
[Install]
WantedBy=multi-user.target
当start的时候就出现了以下错误:
Jan 12 00:02:14 xx.local systemd[1]: mnt-pcap.mount's Where= setting doesn't match unit name. Refusing.
解决
[Mount]下的 Where 挂载目录名与systemd 文件名一致即可
# mv /etc/systemd/system/pcap.mount /etc/systemd/system/data-logs-pcap.mount
# systemctl start data-logs-pcap.mount
# systemctl status data-logs-pcap.mount
● data-logs-pcap.mount - /data/logs/pcap
Loaded: loaded (/etc/fstab; disabled; vendor preset: disabled)
Active: active (mounted) since Sat 2019-01-12 00:29:22 CST; 4s ago
Where: /data/logs/pcap
What: xx.nfsser.xx.local:/nfs
Docs: man:fstab(5)
<省略若干行>