slowdisk fit check: 90d growth headroom (statics grow; /slowdisk is often the root partition)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -113,16 +113,20 @@ prep_static_offload() {
|
||||
# When the statics do NOT fit, FAIL LOUDLY instead of silently extracting everything
|
||||
# onto the primary disk: a silent NVMe fallback violates the caller's capacity math
|
||||
# (operator directive 2026-07-09). --no-slowdisk is the conscious override.
|
||||
local need_gb free_gb floor_gb
|
||||
local need_gb free_gb floor_gb growth_pct
|
||||
floor_gb="${SLOWDISK_FLOOR_GB:-150}"
|
||||
# Static files GROW (reth appends segments as the chain advances, ~5%/mo), and /slowdisk
|
||||
# is usually the SATA root partition — filling it starves the OS/logs. Each offload must
|
||||
# bring its own 90d growth headroom on top of the floor (operator directive 2026-07-09).
|
||||
growth_pct="${SLOWDISK_GROWTH_PCT:-15}"
|
||||
free_gb=$(slowdisk_free_gb || echo "")
|
||||
need_gb=$(awk 'NR>3 && NF>=2 {
|
||||
need_gb=$(awk -v g="$growth_pct" 'NR>3 && NF>=2 {
|
||||
s=$1; mult=1
|
||||
if (s ~ /TB$/) mult=1024; else if (s ~ /MB$/) mult=1/1024; else if (s ~ /KB$/) mult=1/1048576
|
||||
gsub(/[A-Za-z]/, "", s); total+=s*mult
|
||||
} END {printf "%d", total*1.05 + 1}' "$meta")
|
||||
} END {printf "%d", total*1.05*(1+g/100) + 1}' "$meta")
|
||||
if [[ "$free_gb" =~ ^[0-9]+$ && "$need_gb" =~ ^[0-9]+$ ]] && (( free_gb - need_gb < floor_gb )); then
|
||||
echo "ERROR: static offload does not fit on /slowdisk (need ~${need_gb}G static files, free ${free_gb}G, floor ${floor_gb}G)." >&2
|
||||
echo "ERROR: static offload does not fit on /slowdisk (need ~${need_gb}G incl. ${growth_pct}% growth headroom, free ${free_gb}G, floor ${floor_gb}G)." >&2
|
||||
echo " This restore can only fit with --no-slowdisk (extracts everything onto the" >&2
|
||||
echo " primary disk — NVMe capacity accounting will differ from the offload plan)." >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user