Files
proxmox/scripts/archive/consolidated/verify/check-blockscout-disk-usage.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

109 lines
4.2 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
# Check what's using disk space inside Blockscout container (VMID 5000)
# Usage: ./check-blockscout-disk-usage.sh [proxmox-host]
set -e
PROXMOX_HOST="${1:-192.168.11.12}"
VMID=5000
echo "=========================================="
echo "Blockscout Disk Usage Investigation"
echo "=========================================="
echo "Proxmox Host: $PROXMOX_HOST"
echo "VMID: $VMID"
echo "=========================================="
echo ""
# Check container status
echo "=== Container Status ==="
NAME=$(ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct config $VMID 2>/dev/null | grep '^hostname:' | awk '{print \$2}'" || echo "unknown")
STATUS=$(ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct status $VMID 2>/dev/null | awk '{print \$2}'" || echo "unknown")
echo "Name: $NAME"
echo "Status: $STATUS"
echo ""
# Get overall disk usage
echo "=== Overall Disk Usage ==="
DISK_USAGE=$(ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- df -h / 2>/dev/null" || echo "")
echo "$DISK_USAGE"
echo ""
if [ "$STATUS" != "running" ]; then
echo "⚠️ Container is not running, cannot check internal disk usage"
exit 0
fi
# Check largest directories
echo "=== Largest Directories ==="
ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- du -h --max-depth=1 / 2>/dev/null | sort -hr | head -20" || echo "Unable to check directories"
echo ""
# Check Docker disk usage
echo "=== Docker Disk Usage ==="
DOCKER_PS=$(ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- docker ps --format '{{.Names}}' 2>/dev/null" || echo "")
if [ -n "$DOCKER_PS" ]; then
echo "Running containers:"
echo "$DOCKER_PS"
echo ""
echo "Docker system disk usage:"
ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- docker system df 2>/dev/null" || echo "Unable to check Docker disk usage"
echo ""
# Check each container's disk usage
for container in $DOCKER_PS; do
echo "=== Container: $container ==="
ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- docker exec $container du -sh /* 2>/dev/null | sort -hr | head -10" || echo "Unable to check $container"
echo ""
done
else
echo "No Docker containers running"
fi
echo ""
# Check /var/lib/docker
echo "=== Docker Data Directory ==="
ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- du -h --max-depth=2 /var/lib/docker 2>/dev/null | sort -hr | head -20" || echo "Unable to check /var/lib/docker"
echo ""
# Check Blockscout specific directories
echo "=== Blockscout Directories ==="
BLOCKSCOUT_DIRS=("/opt/blockscout" "/var/lib/postgresql" "/var/log" "/tmp")
for dir in "${BLOCKSCOUT_DIRS[@]}"; do
if ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- test -d $dir" 2>/dev/null; then
echo "=== $dir ==="
ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- du -h --max-depth=2 $dir 2>/dev/null | sort -hr | head -10" || echo "Unable to check $dir"
echo ""
fi
done
# Check for large files
echo "=== Largest Files (top 20) ==="
ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- find / -type f -size +100M 2>/dev/null | xargs -I {} sh -c 'du -h {}' 2>/dev/null | sort -hr | head -20" || echo "Unable to find large files"
echo ""
# Check logs
echo "=== Log Directories ==="
LOG_DIRS=("/var/log" "/opt/blockscout/logs" "/tmp")
for dir in "${LOG_DIRS[@]}"; do
if ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- test -d $dir" 2>/dev/null; then
echo "=== $dir (log files) ==="
ssh -o StrictHostKeyChecking=no root@$PROXMOX_HOST "pct exec $VMID -- find $dir -type f -name '*.log' -o -name '*.log.*' 2>/dev/null | xargs -I {} sh -c 'du -h {}' 2>/dev/null | sort -hr | head -10" || echo "No large log files found"
echo ""
fi
done
echo "=========================================="
echo "Investigation Complete"
echo "=========================================="