#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=00_env.sh . "$SCRIPT_DIR/00_env.sh" DEVICES="" SERVERS="" EXECUTE=false usage() { printf 'Usage: %s --fs --devices "/dev/sdb /dev/sdc" --servers "node1,node2" --failure-group --pool --usage [--execute]\n' "$(basename "$0")" } while [[ "$#" -gt 0 ]]; do case "$1" in --fs) FILESYSTEM="${2:-}"; shift 2 ;; --devices) DEVICES="${2:-}"; shift 2 ;; --servers) SERVERS="${2:-}"; shift 2 ;; --failure-group) FAILURE_GROUP="${2:-}"; shift 2 ;; --pool) STORAGE_POOL="${2:-}"; shift 2 ;; --usage) USAGE="${2:-}"; shift 2 ;; --execute) EXECUTE=true; DRY_RUN=false; shift ;; -h|--help) usage; exit 0 ;; *) critical "Unknown argument: $1"; usage; exit 2 ;; esac done section "Recommended GPFS Expansion Flow" cat < Step 3: Detect candidate disks $SCRIPT_DIR/03_detect_new_disks.sh --exclude-mounted --exclude-existing-nsd Step 4: Generate NSD stanza $SCRIPT_DIR/04_create_nsd_stanza.sh --fs --devices "/dev/sdb /dev/sdc" --servers "node1,node2" --failure-group --pool --usage Step 5: Create NSDs and add disks to filesystem $SCRIPT_DIR/05_add_nsd_to_filesystem.sh --fs --stanza [--execute] Step 6: Optional restripe/rebalance $SCRIPT_DIR/06_rebalance_filesystem.sh --fs [--execute] [--background] Step 7: Post-check $SCRIPT_DIR/07_postcheck_gpfs.sh --fs Step 8: Generate report $SCRIPT_DIR/08_generate_report.sh --fs FLOW if [[ -z "$FILESYSTEM" ]]; then warning "No --fs supplied. Printed runbook only." exit 0 fi if [[ "$EXECUTE" == "true" ]]; then warning "--execute was supplied. Destructive steps still require the individual script confirmation prompt." else DRY_RUN=true fi section "Running Safe Read-Only Steps" "$SCRIPT_DIR/01_cluster_overview.sh" || warning "Cluster overview reported warnings or failures" "$SCRIPT_DIR/02_precheck_gpfs.sh" --fs "$FILESYSTEM" || warning "Precheck reported warnings or failures" "$SCRIPT_DIR/03_detect_new_disks.sh" --exclude-mounted --exclude-existing-nsd || warning "Disk detection reported warnings or failures" if [[ -n "$DEVICES" || -n "$SERVERS" || -n "$FAILURE_GROUP" ]]; then if [[ -z "$DEVICES" || -z "$SERVERS" || -z "$FAILURE_GROUP" ]]; then warning "NSD stanza generation requires --devices, --servers, --failure-group, --pool, and --usage" else "$SCRIPT_DIR/04_create_nsd_stanza.sh" \ --fs "$FILESYSTEM" \ --devices "$DEVICES" \ --servers "$SERVERS" \ --failure-group "$FAILURE_GROUP" \ --pool "$STORAGE_POOL" \ --usage "$USAGE" fi fi section "Next Manual Step" if [[ "$EXECUTE" == "true" ]]; then warning "Run 05_add_nsd_to_filesystem.sh manually with --execute after reviewing the generated stanza." else ok "Review outputs and generated stanza. Add disks only through 05_add_nsd_to_filesystem.sh with --execute." fi