From baf26b234fa10f9f1d2e30958c2a0d54e6f8d34c Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Mon, 15 Jun 2026 05:03:16 +0000 Subject: [PATCH] static-file size/manifest: match offloaded (symlinked) dirs + show offload indicator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit find -type d skipped static dirs that are already offloaded (a symlink to /slowdisk is type l, not d) — so show-static-file-size.sh reported zero static for an offloaded node (e.g. bob on de-35), and backup-node.sh would drop them from the manifest (breaking re-offload on the next restore). Match dirs AND symlinks now (root-level entries too). show-static-file-size.sh also tags each static dir with its location: [OFFLOADED -> /slowdisk/...], [on-disk], or [BROKEN SYMLINK ...]. Co-Authored-By: Claude Opus 4.8 (1M context) --- backup-node.sh | 7 +++++-- show-static-file-size.sh | 26 +++++++++++++++++++------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/backup-node.sh b/backup-node.sh index cd8c8de5..5485c146 100755 --- a/backup-node.sh +++ b/backup-node.sh @@ -42,11 +42,14 @@ generate_volume_metadata() { # slash is a path-suffix, so any prefix matches (network-prefixed nitro freezers, # nested l2geth geth/geth/...). Record the CONCRETE relative path so restore-volumes # can recreate the exact static-file -> /slowdisk symlink. + # Match real dirs AND symlinks: an already-OFFLOADED static dir is a symlink to + # /slowdisk, which find -type d alone would skip (then it would be dropped from the + # manifest and the next restore would not re-offload it). local matches=() m rel if [[ "$path" == */* ]]; then - while IFS= read -r m; do matches+=("$m"); done < <(find "$prefix/_data" -type d -path "*/$path" 2>/dev/null) + while IFS= read -r m; do matches+=("$m"); done < <(find "$prefix/_data" \( -type d -o -type l \) -path "*/$path" 2>/dev/null) else - [[ -d "$prefix/_data/$path" ]] && matches+=("$prefix/_data/$path") + m="$prefix/_data/$path"; { [ -d "$m" ] || [ -L "$m" ]; } && matches+=("$m") fi for m in "${matches[@]}"; do rel="${m#"$prefix/_data/"}" diff --git a/show-static-file-size.sh b/show-static-file-size.sh index f85430ef..9dac91ce 100755 --- a/show-static-file-size.sh +++ b/show-static-file-size.sh @@ -26,21 +26,33 @@ for key in $keys; do # Skip empty lines [[ -z "$path" ]] && continue - # Match rule: an entry with NO slash is root-level only (depth-1 under _data), - # so e.g. `snapshots` won't catch postgres pg_logical/snapshots. An entry WITH a - # slash is a path-suffix, so any prefix matches (network-prefixed nitro freezers - # like arbitrum-one/nitro/l2chaindata/ancient, nested l2geth geth/geth/...). + # Match rule: an entry with NO slash is root-level only (depth-1 under _data), so + # e.g. `snapshots` won't catch postgres pg_logical/snapshots. An entry WITH a slash + # is a path-suffix (any prefix: network-prefixed nitro, nested l2geth geth/geth/...). + # Match real dirs AND symlinks: an OFFLOADED static dir is a symlink to /slowdisk, + # which `find -type d` alone would skip. matches=() if [[ "$path" == */* ]]; then - while IFS= read -r d; do matches+=("$d"); done < <(find "$prefix/_data" -type d -path "*/$path" 2>/dev/null) + while IFS= read -r d; do matches+=("$d"); done < <(find "$prefix/_data" \( -type d -o -type l \) -path "*/$path" 2>/dev/null) else - [[ -d "$prefix/_data/$path" ]] && matches+=("$prefix/_data/$path") + m="$prefix/_data/$path"; { [ -d "$m" ] || [ -L "$m" ]; } && matches+=("$m") fi for m in "${matches[@]}"; do size=$(du -sL "$m" 2>/dev/null | awk '{print $1}') static_size=$((static_size + ${size:-0})) size_formatted=$(echo "$(( ${size:-0} * 1024 ))" | numfmt --to=iec --suffix=B --format="%.2f") - echo "$size_formatted $m" >&2 + # offload indicator: is this static dir symlinked out to the /slowdisk extra disk? + if [ -L "$m" ]; then + tgt=$(readlink -f "$m" 2>/dev/null) + case "$tgt" in + /slowdisk/*) loc="[OFFLOADED -> $tgt]" ;; + "") loc="[BROKEN SYMLINK -> $(readlink "$m" 2>/dev/null)]" ;; + *) loc="[SYMLINK -> $tgt]" ;; + esac + else + loc="[on-disk]" + fi + echo "$size_formatted $m $loc" >&2 done done < "$static_file_list" fi