Files
Sankofa/scripts/prepare-ceph-osd-from-ubuntu-vg.sh
defiQUG 33d50fb91e
Some checks failed
API CI / API Lint (push) Successful in 47s
API CI / API Type Check (push) Failing after 47s
API CI / API Test (push) Successful in 1m0s
API CI / API Build (push) Failing after 50s
API CI / Build Docker Image (push) Has been skipped
Build Crossplane Provider / build (push) Failing after 5m51s
CD Pipeline / Deploy to Staging (push) Failing after 29s
CI Pipeline / Lint and Type Check (push) Failing after 36s
CI Pipeline / Build (push) Has been skipped
CI Pipeline / Test Backend (push) Failing after 1m33s
CI Pipeline / Test Frontend (push) Failing after 30s
CI Pipeline / Security Scan (push) Failing after 1m16s
Crossplane Provider CI / Go Test (push) Failing after 3m23s
Crossplane Provider CI / Go Lint (push) Failing after 7m27s
Crossplane Provider CI / Go Build (push) Failing after 3m27s
Deploy to Staging / Deploy to Staging (push) Failing after 30s
Portal CI / Portal Lint (push) Failing after 21s
Portal CI / Portal Type Check (push) Failing after 21s
Portal CI / Portal Test (push) Failing after 21s
Portal CI / Portal Build (push) Failing after 22s
Test Suite / frontend-tests (push) Failing after 30s
Test Suite / api-tests (push) Failing after 49s
Test Suite / blockchain-tests (push) Failing after 30s
Type Check / type-check (map[directory:. name:root]) (push) Failing after 23s
Type Check / type-check (map[directory:api name:api]) (push) Failing after 21s
Type Check / type-check (map[directory:portal name:portal]) (push) Failing after 19s
Validate Configuration Files / validate (push) Failing after 1m52s
CD Pipeline / Deploy to Production (push) Has been skipped
chore: consolidate local WIP (repo cleanup 20260707)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 09:41:34 -07:00

95 lines
2.6 KiB
Bash
Executable File

#!/bin/bash
# Script to free a drive from ubuntu-vg and create Ceph OSD
# Run on R630-01 as root
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
echo "=========================================="
echo "Prepare Drive from ubuntu-vg for Ceph OSD"
echo "=========================================="
echo ""
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo -e "${RED}ERROR: Please run as root${NC}"
exit 1
fi
echo -e "${BLUE}=== Step 1: Current ubuntu-vg Status ===${NC}"
echo "-----------------------------------"
if vgs ubuntu-vg &>/dev/null; then
echo "Volume Group Information:"
vgs ubuntu-vg
echo ""
echo "Logical Volumes:"
lvs ubuntu-vg
echo ""
echo "Physical Volumes:"
pvs | grep ubuntu-vg
echo ""
else
echo -e "${YELLOW}ubuntu-vg not found${NC}"
echo ""
fi
echo -e "${BLUE}=== Step 2: Available 250GB Drives ===${NC}"
echo "-----------------------------------"
echo "250GB drives detected:"
drives=()
for disk in sdc sdd sde sdf sdg sdh; do
if [ -b "/dev/$disk" ]; then
size=$(fdisk -l "/dev/$disk" 2>/dev/null | grep "^Disk /dev/$disk" | awk '{print $3, $4}')
in_vg=$(pvs 2>/dev/null | grep "/dev/${disk}3" | grep ubuntu-vg | wc -l)
if [ "$in_vg" -gt 0 ]; then
echo -e " ${YELLOW}/dev/$disk: ${size} - In ubuntu-vg${NC}"
drives+=("$disk")
else
echo -e " ${GREEN}/dev/$disk: ${size} - Available${NC}"
drives+=("$disk")
fi
fi
done
echo ""
echo -e "${BLUE}=== Step 3: Current Ceph OSD Status ===${NC}"
echo "-----------------------------------"
ceph osd tree 2>/dev/null || echo -e "${YELLOW}Ceph not accessible${NC}"
echo ""
echo "=========================================="
echo -e "${GREEN}Ready to Prepare Drive${NC}"
echo "=========================================="
echo ""
echo "To prepare a drive for Ceph OSD, run:"
echo ""
echo -e "${YELLOW}# Choose a drive (e.g., sdc, sdd, sde, sdf, sdg, or sdh)${NC}"
echo -e "${YELLOW}# Replace DRIVE with your choice${NC}"
echo ""
echo "# 1. Check if drive is in ubuntu-vg"
echo "pvs | grep DRIVE"
echo ""
echo "# 2. If in ubuntu-vg, unmount and remove (WARNING: Destroys data!)"
echo "umount /dev/ubuntu-vg/* 2>/dev/null || true"
echo "vgchange -a n ubuntu-vg"
echo "pvremove /dev/DRIVE3"
echo ""
echo "# 3. Wipe the entire drive"
echo "wipefs -a /dev/DRIVE"
echo "dd if=/dev/zero of=/dev/DRIVE bs=1M count=100"
echo ""
echo "# 4. Create Ceph OSD"
echo "ceph-volume lvm create --data /dev/DRIVE"
echo ""
echo "# 5. Verify"
echo "ceph osd tree"
echo "ceph health"
echo ""