GFS2 over DRBD automount

drbdfailoverclusterfstabgfs2proxmox

I have 2 nodes Proxmox cluster.
For KVM images I use DRBD device with GFS2 on it.
Everything works fine except GFS2 automounting after server restart.

I put in fstab:

/dev/drbd0 /cluster/drbd0 gfs2 rw,noatime,nodiratime,_netdev 0 0

Manually it mounts ok (mount /dev/drbd0), but after every restart I have to mount it manually.

Since I use Proxmox it is preferably to use its capabilities.

So, how to make this mount point automount?

Best Answer

You should creat a init script to make GFS2 automount at boot. I have writed my own for Ubuntu, it's work for me in my lab enviroment.

#!/bin/bash
#
# Must check to mount after DRBD start and unmount before DRBD stop
# Check /etc/init.d for correct priority
#
# update-rc.d mountgfs2.sh start 90 3 4 5 stop 09 0 1 6
#

case $1 in

    start) echo "Start mounting..."
           mount -t gfs2 /dev/drbd0 /mnt/data
           ;;

     stop) echo "Stop mounting..."
           umount /dev/drbd0
           ;;

        *) echo "Usage: /etc/init.d/mountgfs2.sh (start|stop)"
           exit 1
           ;;
esac

exit 0

Remember the script must run after DRDB service start when startup and before DRBD service stop when shutdown

Related Topic