From 3caa4ab8734ca1e4d5761917836f2f5fc78c8219 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Mon, 15 Jun 2026 04:39:48 +0000 Subject: [PATCH] restore: gate static-file offload on SLOWDISK env var (.env), not just /slowdisk presence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A `/slowdisk` directory exists on hosts even when it is just a folder on the root disk (no dedicated extra disk) — offloading there gives no benefit. Source the host .env and require SLOWDISK to be set (operator sets it only on hosts with a real extra disk mounted at /slowdisk) before activating the static-file -> /slowdisk symlink offload. Unset = normal extract everywhere. Target path stays /slowdisk (the fixed in-container mount). Co-Authored-By: Claude Opus 4.8 (1M context) --- restore-volumes.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/restore-volumes.sh b/restore-volumes.sh index b2d9337c..76afe785 100755 --- a/restore-volumes.sh +++ b/restore-volumes.sh @@ -1,6 +1,10 @@ #!/bin/bash dir="$(dirname "$0")" source "$dir/volume-utils.sh" +# Host config: SLOWDISK gates the static-file offload (see prep_static_offload). It must be +# set ONLY on hosts that have a real dedicated extra disk mounted at /slowdisk; on hosts +# where /slowdisk is just a folder on the root disk, offloading gives no benefit. +[ -f "$dir/.env" ] && source "$dir/.env" remote_source="$2" if [[ -n "$remote_source" ]] && is_local_backup_url "$remote_source"; then @@ -24,9 +28,12 @@ fi # hot/dynamic state stays on the primary disk. tar then extracts THROUGH the symlinks via # --keep-directory-symlink (it keeps the dir-symlinks instead of clobbering them). # Target naming matches delete-volumes.sh / delete_slowdisk_targets_for_key cleanup. -# Safe fallbacks (just extract normally): no /slowdisk, no manifest, or no static paths. +# GATED on the SLOWDISK env var from .env: only hosts with a real dedicated extra disk set +# it. Safe fallbacks (just extract normally): SLOWDISK unset, /slowdisk missing, no manifest, +# or no static paths. (/slowdisk is the fixed in-container mount, so the target path is fixed.) prep_static_offload() { local key=$1 meta=$2 data_dir=$3 rel target + [ -n "${SLOWDISK:-}" ] || { echo " SLOWDISK not set in .env (no dedicated extra disk) — no static offload"; return 0; } [ -d /slowdisk ] || { echo " /slowdisk absent — no static offload"; return 0; } [ -f "$meta" ] || { echo " no manifest ($meta) — no static offload"; return 0; } # manifest data lines (after the 3-line header) are " "