I have configured gluserfs on a pair of servers and I'm able to mount this on my client machines. I want to also be able to mount the glusterfs filesystem on both of the glusterfs servers on boot when I take both machines offline and start them from scratch.

These servers are set up as a cluster using pacemaker. In addition to a shared database, pacemaker is also providing a virtual IP address to mount the gluster filesystem from.

I can manually mount the filesystem on each after both servers are up with the command:

mount -t glusterfs nodea:/gv0 /data

Which is great. But I want this to happen automatically at boot.

So I've tried adding an entry to the fstab:

nodea:/gv0  /data       glusterfs   _netdev 0 0

Which works when I run the "mount -a" command after the cluster is up and running. However, it does not work at boot. (This is how the client machines mount the glusterfs on boot, but the cluster is up and running. So of course it works on boot for them.)

I have also tried creating a systemd unit file to handle the mounting of the glusterfs at boot. My unit file is in /etc/systemd/system named "data.mount" and looks like:

# Mounting gluster fs at /data

Description = Automount gluster filesystem


WantedBy = pcsd.service

Again, this works when both servers are up and running by running the command "systemctl start data.mount". It also works if I only reboot one of the machines in the cluster. But it doesn't work on a reboot of both servers.

If both nodes in the cluster go down, or if I feel like rebooting both at the same time for whatever reason, I want to be sure that when both machines come back up, that the glusterfs is mounted on /data.

As a work around, I've added the following lines to root's crontab on both machines:

@reboot sleep 60 && mount -t glusterfs nodea:/gv0 /data
@reboot sleep 300 && mount -t glusterfs nodea:/gv0 /data

This works if I start both severs up from scratch. But my concern is that if the pacemaker service ever takes longer than 5 minutes to start up, then I still don't have the gluster filesystem mounted on the server at /data.

Is there a way to have the systemd unit file check if it actually mounted the filesystem and if not to retry until it does?

Is there some other way to have the glusterfs mount at boot and to check that it's actually mounted?

  • Why are you using a vip via pacemaker for this? Glusterfs doesn't require this to be clustered. Is this for some other cluster that's colocated on the same instances?
    – Spooler
    May 1 '17 at 21:29

You should be able to have systemd automount when needed. I was having problems with Ubuntu 16.04 mounting at boot as well. Based on this message I added noauto,x-systemd.automount to my fstab line:

gluster1:/volume1   /storage-pool   glusterfs   defaults,_netdev,noauto,x-systemd.automount 0 0

I have rebooted the app servers a few times each and they have all successfully mounted. I hope this helps you too!

  • I've done similar via autofs with success. This is easier to manage.
    – Spooler
    May 1 '17 at 21:38
  • I'm using Ubuntu 18.04.5 LTS. This solution doesn't work. Always I'm manually mounting GFS volumes after each boot. Any suggestions to newer Ubuntu versions?
    – inckka
    Aug 6 at 1:49

I've been hacking around this issue given LP's attitude:

file: /etc/systemd/system/glusterfsmounts.service:


ExecStartPre=/usr/sbin/gluster volume list
ExecStart=/bin/mount -a -t glusterfs


then you would:

systemctl daemon-reload

systemctl enable glusterfsmounts

and reboot... been the best/stablest thus far for me


You can use a script to hold up the "started" status of systemd's glusterfs service until the volumes are actually ready.

systemctl edit glusterd.service


Create the file /usr/local/sbin/glusterfs-wait with the following:

until [ $FAIL -eq 0 ]; do
    gluster volume status all
    test $FAIL -ne 0 && sleep 1
exit 0

Make sure this file is executable.

Then create the mount override, for example for /mnt/storage it would be mnt-storage.mount, slashes become hyphens.

systemctl edit mnt-storage.mount

If this doesn't work and you just added the fstab entry, reload systemd to have it see the update (systemctl daemon-reload).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.