fix(specs): measure DISK_GB at /var/lib/archipelago, not /

The reconcile spec for bitcoin-knots auto-enables prune=550 when
DISK_GB < 1000. DISK_GB was measured via `df /`, which on every
archy install reports the ~30 GB OS partition because user data
lives on a separate encrypted /var/lib/archipelago volume.

Result: every archy node with a 2 TB data drive was silently being
configured as a pruned node, and any bitcoin-knots container
recreated by reconcile would delete its historical blocks down to
the 550 MB prune window on next start.

Observed on .228 (2 TB box): blocks dir went from 384 GB to 926 MB
after a reconcile-triggered restart. Historical archive unrecoverable
without full re-IBD from genesis.

Fix: check /var/lib/archipelago first (where bitcoin data actually
lives). Fall back to / only on first-boot before the data partition
is mounted.
This commit is contained in:
archipelago
2026-04-23 09:54:16 -04:00
parent 92612ddc70
commit 06dcdafda4

View File

@@ -26,7 +26,15 @@ done
# ── Environment detection ─────────────────────────────────────────────
detect_environment() {
DISK_GB=$(df --output=size -BG / 2>/dev/null | tail -1 | tr -dc '0-9')
# Measure disk where container data actually lives, not the OS partition.
# Archipelago installs mount a separate (usually-encrypted) data volume at
# /var/lib/archipelago on any host with meaningful storage, so checking /
# would always report the ~30 GB OS partition and wrongly trip prune mode
# on 2 TB boxes. Fall back to / only for first-boot before the data
# partition is mounted.
local disk_target="/var/lib/archipelago"
[ -d "$disk_target" ] || disk_target="/"
DISK_GB=$(df --output=size -BG "$disk_target" 2>/dev/null | tail -1 | tr -dc '0-9')
DISK_GB=${DISK_GB:-500}
TOTAL_MEM_MB=$(($(awk '/MemTotal/{print $2}' /proc/meminfo 2>/dev/null || echo 16000000) / 1024))
LOW_MEM=false