1

I need to get a gluster volume to mount on boot. Placing it in /etc/fstab does not produce reliable results.

I setup the following systemd service:

[Unit]
Description=Gluster Mount

[Service]
Type=oneshot
ExecStart=/bin/mount /data
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

When this service runs at boot, it returns the following:

root@web1:~# systemctl status gluster-mount.service
รข gluster-mount.service - Gluster Mount
   Loaded: loaded (/etc/systemd/system/gluster-mount.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-03-13 04:05:43 UTC; 3min 20s ago
  Process: 627 ExecStart=/bin/mount /data (code=exited, status=1/FAILURE)
 Main PID: 627 (code=exited, status=1/FAILURE)

Mar 13 04:05:39 web1 systemd[1]: Starting Gluster     Mount...
Mar 13 04:05:43 web1 systemd[1]: gluster-mount.service: Main process exited, code=exited, status=1/FAILURE
Mar 13 04:05:43 web1 systemd[1]: Failed to start Gluster Mount.
Mar 13 04:05:43 web1 systemd[1]: gluster-mount.service: Unit entered failed state.
Mar 13 04:05:43 web1 systemd[1]: gluster-mount.service: Failed with result 'exit-code'.

When I issue a "restart" on this service after logging in, it works fine. What am I missing?

Aaron A
  • 239
  • 2
  • 14

1 Answers1

1

So, change the type to idle solved the problem. By definition, the idle type will wait until everything else has been dispatched before processing that service request. I had a hunch it had to do with timing, and this was the only thing that actually corrected the issue.

[Unit]
Description=Gluster Mount

[Service]
Type=idle
ExecStart=/bin/mount /data
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target
Aaron A
  • 239
  • 2
  • 14