fix: rewrite tar extract onto target volumes root when it is a cross-device symlink
Hosts like rpc-us-32 put /var/lib/docker (or volumes/) on another mount; tar -C / then EXDEV on every var/lib/docker/volumes/... member. Canonicalize the deepest static prefix (readlink -f /var/lib/docker/volumes) and append a --transform after SLOWDISK_TRANSFORMS. Keying only on /var/lib/docker misses a real docker root with volumes/ as the symlink. No-op on normal hosts. Per-volume _data static-file offload stays on SLOWDISK_TRANSFORMS. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -350,6 +350,17 @@ transfer_backup() {
|
||||
echo "No metadata file found, using normal extraction"
|
||||
fi
|
||||
|
||||
|
||||
# AFTER SLOWDISK_TRANSFORMS: rewrite remaining var/lib/docker/ members onto
|
||||
# the target's real docker root when it is a cross-device symlink (see
|
||||
# docker_root_transform in volume-utils.sh).
|
||||
local _drt
|
||||
_drt=$(docker_root_transform)
|
||||
if [[ -n "$_drt" ]]; then
|
||||
echo "Target /var/lib/docker is a symlink; appending docker-root --transform (after slowdisk)"
|
||||
tar_extract_opts="${tar_extract_opts}${_drt}"
|
||||
fi
|
||||
|
||||
local file_size=$(stat -f%z "$backup_file" 2>/dev/null || stat -c%s "$backup_file" 2>/dev/null)
|
||||
|
||||
# Find an available port
|
||||
@@ -529,6 +540,17 @@ transfer_backup_ssh() {
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# AFTER SLOWDISK_TRANSFORMS: rewrite remaining var/lib/docker/ members onto
|
||||
# the target's real docker root when it is a cross-device symlink (see
|
||||
# docker_root_transform in volume-utils.sh).
|
||||
local _drt
|
||||
_drt=$(docker_root_transform)
|
||||
if [[ -n "$_drt" ]]; then
|
||||
echo "Target /var/lib/docker is a symlink; appending docker-root --transform (after slowdisk)"
|
||||
tar_extract_opts="${tar_extract_opts}${_drt}"
|
||||
fi
|
||||
|
||||
echo "Using direct SSH transfer for $key (file: $(basename "$backup_file"), size: $((file_size / 1048576))MB)"
|
||||
|
||||
pv -pterb -s "$file_size" -N "$key" < "$backup_file" | \
|
||||
|
||||
Reference in New Issue
Block a user