1

I have the following nfd share folder on my linux client ( redhat 7.2 )

master1:/nfs             41932800 6601728  35331072  16% /nfsshare

we decided to use the service auto fs in case this share folder is unmounted

we created the following service ( according to link - 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

the conf

 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

and

systemctl daemon-reload

and

 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)

we not understand why service complain about -

[/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

what is wrong in service syntax ?

shalom
  • 461
  • 13
  • 29

1 Answers1

2

Mount unit configuration files in systemd are not services, they need a file name extension of .mount not .service

HBruijn
  • 77,029
  • 24
  • 135
  • 201
  • so I need to rename the - auto-mnt.service to auto-mnt.mount? – shalom May 10 '19 at 15:42
  • after I changed the name , what are the other steps that I need to do in order to mount the folder auto in case folder isn't mounted? – shalom May 10 '19 at 15:57