Files
proxmox/scripts/restore-lvm-volumes.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

62 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Load IP configuration
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
# Script to restore LVM logical volumes from backup
# This is needed after RAID recreation
set -u
TARGET_NODE="r630-01"
TARGET_NODE_IP="${PROXMOX_HOST_R630_01}"
TARGET_NODE_PASS="password"
ssh_r630_01() {
sshpass -p "$TARGET_NODE_PASS" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 root@"$TARGET_NODE_IP" "$@" 2>&1
}
log_info() { echo -e "\033[0;34m[INFO]\033[0m $1"; }
log_success() { echo -e "\033[0;32m[✓]\033[0m $1"; }
log_error() { echo -e "\033[0;31m[✗]\033[0m $1"; }
log_warn() { echo -e "\033[1;33m[⚠]\033[0m $1"; }
# Check if we can find the data on the RAID
log_info "Checking RAID and VG status..."
ssh_r630_01 "cat /proc/mdstat | grep md0"
ssh_r630_01 "vgs pve"
ssh_r630_01 "pvs | grep pve"
log_info "Attempting to restore logical volumes..."
log_warn "This is a critical operation - data recovery may be needed"
# Try to use vgcfgrestore with all available backups
log_info "Checking available backups..."
BACKUP_FILE=$(ssh_r630_01 "ls -t /etc/lvm/backup/pve* /etc/lvm/archive/pve_*.vg 2>/dev/null | head -1")
if [ -n "$BACKUP_FILE" ]; then
log_info "Found backup: $BACKUP_FILE"
log_info "Attempting full restore..."
ssh_r630_01 "vgcfgrestore -f $BACKUP_FILE pve --force" || {
log_error "Restore failed"
exit 1
}
log_info "Activating VG..."
ssh_r630_01 "vgchange -ay pve"
log_info "Scanning for logical volumes..."
ssh_r630_01 "lvscan"
log_info "Current LVM status:"
ssh_r630_01 "lvs -a"
else
log_error "No backup file found"
exit 1
fi
log_info "Done. Check lvs output above to see if volumes were restored."