#!/bin/sh usage() { echo "Usage: llxcfg-cluster fix-cluster (no superblock restore) \tllxcfg-cluster fix-cluster-superblock [NUM_BACKUP_SUPERBLOCK 1-6] \tllxcfg-cluster reconfigure-ocfs2 \tllxcfg-cluster force-umount \tllxcfg-cluster start-service (only mount ocfs2) \tllxcfg-cluster restart-service (also force umount) \tllxcfg-cluster tune-nodes {NUM_NODES} (new max slots nodes. Default:8) \tllxcfg-cluster restart-cluster (restarts ocfs2 cluster and mount service) \tllxcfg-cluster stats \tllxcfg-cluster nodes \tllxcfg-cluster cap-replication [ENABLED|DISABLED] " exit 0 } [ $1 ] || usage [ "$(id -u)" != "0" ] && exit 0 VAR_LIST="OCFS2_NET_EXPORT_DIRS OCFS2_MOUNT_FSTAB OCFS2_DISK" LLX_GETVAR="/usr/sbin/llxcfg-showvars" eval `${LLX_GETVAR} ${VAR_LIST}` case $1 in fix-cluster) CHECK_MOUNT_OCFS2=$(LC_ALL=C awk -v dev="$OCFS2_DISK" -v fstab="$OCFS2_MOUNT_FSTAB" '$1 == dev && $2 == fstab && $3 == "ocfs2" { print "yes" }' /proc/mounts) [ "$CHECK_MOUNT_OCFS2" = "yes" ] && echo "Please first umount your OCFS2 filesystem." && exit 0 fsck.ocfs2 -f -p -y $OCFS2_DISK export DEBIAN_FRONTEND=noninteractive export DEBCONF_FRONTEND=noninteractive /etc/init.d/ocfs2 stop /etc/init.d/o2cb stop dpkg-reconfigure ocfs2-tools /etc/init.d/o2cb restart /etc/init.d/ocfs2 restart ;; fix-cluster-superblock) CHECK_MOUNT_OCFS2=$(LC_ALL=C awk -v dev="$OCFS2_DISK" -v fstab="$OCFS2_MOUNT_FSTAB" '$1 == dev && $2 == fstab && $3 == "ocfs2" { print "yes" }' /proc/mounts) [ "$CHECK_MOUNT_OCFS2" = "yes" ] && echo "Please first umount your OCFS2 filesystem." && exit 0 BLOCK=2 [ $2 ] && BLOCK=$2 fsck.ocfs2 -f -y -r $BLOCK $OCFS2_DISK export DEBIAN_FRONTEND=noninteractive export DEBCONF_FRONTEND=noninteractive /etc/init.d/ocfs2 stop /etc/init.d/o2cb stop dpkg-reconfigure ocfs2-tools /etc/init.d/o2cb restart /etc/init.d/ocfs2 restart ;; force-umount) /etc/init.d/llxcfg-ocfs2-umount-net stop service llxcfg-ocfs2-net stop ;; start-service) service llxcfg-ocfs2-net start ;; restart-service) CHECK_MOUNT_OCFS2=$(LC_ALL=C awk -v dev="$OCFS2_DISK" -v fstab="$OCFS2_MOUNT_FSTAB" '$1 == dev && $2 == fstab && $3 == "ocfs2" { print "yes" }' /proc/mounts) if [ "$CHECK_MOUNT_OCFS2" = "yes" ]; then /etc/init.d/llxcfg-ocfs2-umount-net stop fi service llxcfg-ocfs2-net stop service llxcfg-ocfs2-net start ;; tune-nodes) [ "$CHECK_MOUNT_OCFS2" = "yes" ] && echo "Please first umount your OCFS2 filesystem." && exit 0 [ $2 ] && tunefs.ocfs2 -N $2 $OCFS2_DISK && exit 0 echo "Please especify Max Node Slots." ;; restart-cluster) /etc/init.d/llxcfg-ocfs2-umount-net stop service llxcfg-ocfs2-net stop /etc/init.d/ocfs2 stop /etc/init.d/o2cb stop /etc/init.d/o2cb start /etc/init.d/ocfs2 start service llxcfg-ocfs2-net start ;; reconfigure-ocfs2) /etc/init.d/llxcfg-ocfs2-umount-net stop service llxcfg-ocfs2-net stop /etc/init.d/ocfs2 stop /etc/init.d/o2cb stop export DEBIAN_FRONTEND=noninteractive export DEBCONF_FRONTEND=noninteractive dpkg-reconfigure ocfs2-tools /etc/init.d/o2cb restart /etc/init.d/ocfs2 restart service llxcfg-ocfs2-net start ;; cap-replication) [ "$2" = "ENABLED" ] && llxcfg-setvars CAP_DATA_REPLICATION='ENABLED' [ "$2" = "DISABLED" ] && llxcfg-setvars CAP_DATA_REPLICATION='DISABLED' ;; stats) debugfs.ocfs2 -R "stats" $OCFS2_DISK ;; nodes) mounted.ocfs2 -f ;; esac