#!/bin/bash # Reinitialize Ceph cluster after reinstall set -e FSID="5fb968ae-12ab-405f-b05f-0df29a168328" PUBLIC_NETWORK="192.168.11.0/24" CLUSTER_NETWORK="192.168.11.0/24" echo "=== Reinitializing Ceph Cluster ===" # Check if we're on a Proxmox node if [ ! -d "/etc/pve" ]; then echo "ERROR: This script must be run on a Proxmox node" exit 1 fi echo "" echo "=== Step 1: Creating Ceph configuration ===" cat > /etc/pve/ceph.conf </dev/null || true fi echo "Configuration created" echo "" echo "=== Step 2: Initializing Ceph cluster ===" HOSTNAME=$(hostname) if [ "$HOSTNAME" = "ml110-01" ]; then echo "Initializing cluster on ml110-01..." pveceph init --network $PUBLIC_NETWORK --cluster-network $CLUSTER_NETWORK 2>&1 || echo "Init may have already been done" fi echo "" echo "=== Step 3: Creating monitors ===" if [ "$HOSTNAME" = "ml110-01" ]; then echo "Creating monitor on ml110-01..." pveceph mon create ml110-01 2>&1 || echo "Monitor may already exist" fi if [ "$HOSTNAME" = "r630-01" ]; then echo "Creating monitor on r630-01..." pveceph mon create r630-01 2>&1 || echo "Monitor may already exist" fi echo "" echo "=== Step 4: Starting monitor services ===" systemctl enable ceph-mon@$HOSTNAME systemctl start ceph-mon@$HOSTNAME sleep 5 systemctl status ceph-mon@$HOSTNAME --no-pager | head -15 echo "" echo "=== Step 5: Verifying quorum ===" sleep 10 ceph quorum_status 2>&1 | head -20 || echo "Quorum not yet established, may take a few minutes" echo "" echo "=== COMPLETE ===" echo "Ceph cluster reinitialized. Next:" echo "1. Verify quorum: ceph quorum_status" echo "2. Create OSDs: ceph-volume lvm create --data /dev/" echo "3. Check cluster health: ceph -s"