我的 linux 客户端(redhat 7.2)上有以下 nfd 共享文件夹
master1:/nfs 41932800 6601728 35331072 16% /nfsshare
我们决定使用服务 auto fs 以防此共享文件夹被卸载
我们创建了以下服务(根据链接 - https://michlstechblog.info/blog/systemd-automount-nfs-export/)
ls -ltr auto-mnt.service
-rw-r--r-- 1 root root 212 May 10 12:38 auto-mnt.service
会议
more auto-mnt.service
[Unit]
Description=nfs mount script
Requires=network-online.target
After=network-online.service
[Mount]
What=master1:/nfs
Where=/nfsshare
Options=
Type=nfs
[Install]
WantedBy=multi-user.target
和
systemctl daemon-reload
和
systemctl start auto-mnt.service
Failed to start auto-mnt.service: Unit auto-mnt.service failed to load: Invalid argument. See system logs and 'systemctl status auto-mnt.service' for details.
[root@ system]# systemctl status auto-mnt.service
● auto-mnt.service - nfs mount script
Loaded: error (Reason: Invalid argument)
Active: inactive (dead)
我们不明白为什么服务抱怨 -
[/etc/systemd/system/auto-mnt.service:6] Unknown section 'Mount'. Ignoring.
auto-mnt.service lacks both ExecStart= and ExecStop= setting. Refusing.
Unknown section 'Mount'. Ignoring
服务语法有什么问题?
systemd 中的挂载单元配置文件不是服务,它们需要的文件扩展名为
.mount
not.service