Files
Sankofa/scripts/check-ubuntu-vg-and-prepare-osd.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

113 lines
3.7 KiB
Bash
Executable File

#!/bin/bash
# Script to check ubuntu-vg and prepare a drive for Ceph OSD
# Run on R630-01
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
echo "=========================================="
echo "Checking ubuntu-vg and Preparing 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 "-----------------------------------"
echo "Volume Group Information:"
vgs ubuntu-vg 2>/dev/null || echo -e "${YELLOW}ubuntu-vg not found${NC}"
echo ""
echo "Logical Volumes in ubuntu-vg:"
lvs ubuntu-vg 2>/dev/null || echo -e "${YELLOW}No logical volumes found${NC}"
echo ""
echo "Physical Volumes in ubuntu-vg:"
pvs | grep ubuntu-vg || echo -e "${YELLOW}No physical volumes found${NC}"
echo ""
echo -e "${BLUE}=== Step 2: All Block Devices ===${NC}"
echo "-----------------------------------"
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,FSTYPE,MODEL | grep -E "NAME|sd"
echo ""
echo -e "${BLUE}=== Step 3: Identifying 250GB Drives ===${NC}"
echo "-----------------------------------"
echo "Drives that are ~250GB (247-248 GB):"
for disk in /dev/sd[a-z]; do
if [ -b "$disk" ]; then
size_info=$(fdisk -l "$disk" 2>/dev/null | grep "^Disk $disk" | awk '{print $3, $4}')
if [ ! -z "$size_info" ]; then
size_num=$(echo "$size_info" | grep -oE '[0-9]+' | head -1)
if [ "$size_num" -ge 247 ] && [ "$size_num" -le 248 ]; then
echo -e "${GREEN} $disk: ${size_info}${NC}"
# Check if it's in ubuntu-vg
in_vg=$(pvs 2>/dev/null | grep "$disk" | grep ubuntu-vg | wc -l)
if [ "$in_vg" -gt 0 ]; then
echo -e " ${YELLOW} → In ubuntu-vg volume group${NC}"
fi
fi
fi
fi
done
echo ""
echo -e "${BLUE}=== Step 4: Checking What's Using ubuntu-vg ===${NC}"
echo "-----------------------------------"
if vgs ubuntu-vg &>/dev/null; then
echo "Logical volumes in ubuntu-vg:"
lvs ubuntu-vg -o lv_name,lv_size,lv_attr,mountpoint 2>/dev/null
echo ""
echo "Checking if LVs are mounted:"
for lv in $(lvs ubuntu-vg -o lv_path --no-headings 2>/dev/null | awk '{print $1}'); do
if [ ! -z "$lv" ]; then
mount_point=$(mount | grep "$lv" | awk '{print $3}')
if [ ! -z "$mount_point" ]; then
echo -e " ${YELLOW}$lv is mounted at $mount_point${NC}"
else
echo -e " ${GREEN}$lv is not mounted${NC}"
fi
fi
done
else
echo -e "${YELLOW}ubuntu-vg not found${NC}"
fi
echo ""
echo -e "${BLUE}=== Step 5: Current Ceph OSD Status ===${NC}"
echo "-----------------------------------"
ceph osd tree 2>/dev/null || echo -e "${YELLOW}Ceph not accessible${NC}"
echo ""
echo "=========================================="
echo -e "${GREEN}Summary and Recommendations${NC}"
echo "=========================================="
echo ""
echo "If ubuntu-vg is not needed:"
echo "1. Unmount any mounted logical volumes"
echo "2. Remove logical volumes from ubuntu-vg"
echo "3. Remove physical volumes from ubuntu-vg"
echo "4. Remove ubuntu-vg volume group"
echo "5. Wipe the drive(s) to prepare for Ceph OSD"
echo ""
echo "If you need to free up a drive for Ceph OSD:"
echo "1. Identify which drive to use (e.g., /dev/sdc)"
echo "2. Remove it from ubuntu-vg (if safe to do so)"
echo "3. Wipe the drive: wipefs -a /dev/sdX"
echo "4. Create Ceph OSD: ceph-volume lvm create --data /dev/sdX"
echo ""
echo -e "${YELLOW}WARNING: Removing drives from ubuntu-vg will destroy data!${NC}"
echo "Make sure ubuntu-vg is not needed before proceeding."
echo ""