3

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?

Anton
  • 115
  • 10

1 Answers1

2

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

cuonglm
  • 2,346
  • 2
  • 15
  • 20
  • I thought about script, but i wonder if there is really 'native' way to automount? – Anton May 10 '13 at 10:46
  • As far as I know, there isn't really 'native' way. – cuonglm May 10 '13 at 11:47
  • 1
    @Anton the "native" way would be `/etc/fstab` but like with NFS there have to be special tricks to wait for the actual mount until the network-part and the related services are up and running. Strange that GFS2 does not provide this (i.e. according init-scripts) on its own. OCFS2 does. – Nils Jun 01 '13 at 20:03
  • Finally I have achieved desired behavior by describing "clusterfs" service in CMAN configuration (Proxmox uses CMAN), so for now it is most "native" way for cluster I found – Anton Jun 10 '13 at 09:27