Fix /slowdisk static-file offload: add reth guard and --keep-directory-symlink
- Add RETH GUARD to clone-backup.sh and clone-node.sh: when the config name contains 'reth', skip the whole /slowdisk static-file symlink offload and extract everything onto the primary disk (equivalent to --no-slowdisk). This matches the already-correct restore-volumes.sh behavior. Reason: reth refuses to start when its static_files directory is a symlink, failing at boot with 'failed to create dir static_files: File exists'. - Add --keep-directory-symlink to all tar extraction options in both scripts for the SLOWDISK path. This allows tar to extract files THROUGH the pre-created directory symlinks instead of trying to mkdir over them (which fails with 'Cannot mkdir: File exists'). This matches the already-correct restore-volumes.sh behavior. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -306,7 +306,7 @@ transfer_backup() {
|
|||||||
local backup_basename=$(basename "$backup_file" .tar.zst)
|
local backup_basename=$(basename "$backup_file" .tar.zst)
|
||||||
local metadata_file="$backup_dir/${backup_basename}.txt"
|
local metadata_file="$backup_dir/${backup_basename}.txt"
|
||||||
local use_slowdisk=false
|
local use_slowdisk=false
|
||||||
local tar_extract_opts="-xf - -C /"
|
local tar_extract_opts="-xf - -C / --keep-directory-symlink"
|
||||||
|
|
||||||
if [[ -f "$metadata_file" ]] && check_slowdisk_enabled; then
|
if [[ -f "$metadata_file" ]] && check_slowdisk_enabled; then
|
||||||
echo "Metadata file found and SLOWDISK mode enabled"
|
echo "Metadata file found and SLOWDISK mode enabled"
|
||||||
@@ -324,8 +324,9 @@ transfer_backup() {
|
|||||||
if setup_slowdisk_structure "$key" "$static_size_kb" "${static_paths[@]}"; then
|
if setup_slowdisk_structure "$key" "$static_size_kb" "${static_paths[@]}"; then
|
||||||
use_slowdisk=true
|
use_slowdisk=true
|
||||||
# Use --skip-old-files to avoid overwriting existing symlinks/directories
|
# Use --skip-old-files to avoid overwriting existing symlinks/directories
|
||||||
# But we still want to extract files into symlinked directories
|
# and --keep-directory-symlink so tar extracts THROUGH the pre-created dir symlinks
|
||||||
tar_extract_opts="-xf - -C / --skip-old-files"
|
# instead of trying to mkdir over them (which fails with 'Cannot mkdir: File exists')
|
||||||
|
tar_extract_opts="-xf - -C / --skip-old-files --keep-directory-symlink"
|
||||||
echo "SLOWDISK structure ready, will extract respecting symlinks"
|
echo "SLOWDISK structure ready, will extract respecting symlinks"
|
||||||
else
|
else
|
||||||
echo "Warning: Failed to setup SLOWDISK structure, falling back to normal extraction"
|
echo "Warning: Failed to setup SLOWDISK structure, falling back to normal extraction"
|
||||||
@@ -494,7 +495,7 @@ transfer_backup_ssh() {
|
|||||||
# Check for metadata file and SLOWDISK mode (same logic as transfer_backup)
|
# Check for metadata file and SLOWDISK mode (same logic as transfer_backup)
|
||||||
local backup_basename=$(basename "$backup_file" .tar.zst)
|
local backup_basename=$(basename "$backup_file" .tar.zst)
|
||||||
local metadata_file="$backup_dir/${backup_basename}.txt"
|
local metadata_file="$backup_dir/${backup_basename}.txt"
|
||||||
local tar_extract_opts="-xf - -C /"
|
local tar_extract_opts="-xf - -C / --keep-directory-symlink"
|
||||||
|
|
||||||
if [[ -f "$metadata_file" ]] && check_slowdisk_enabled; then
|
if [[ -f "$metadata_file" ]] && check_slowdisk_enabled; then
|
||||||
echo "Metadata file found and SLOWDISK mode enabled"
|
echo "Metadata file found and SLOWDISK mode enabled"
|
||||||
@@ -508,7 +509,9 @@ transfer_backup_ssh() {
|
|||||||
if [[ ${#static_paths[@]} -gt 0 ]] && [[ -n "$static_size_kb" ]]; then
|
if [[ ${#static_paths[@]} -gt 0 ]] && [[ -n "$static_size_kb" ]]; then
|
||||||
# Setup slowdisk structure on remote
|
# Setup slowdisk structure on remote
|
||||||
if setup_slowdisk_structure "$key" "$static_size_kb" "${static_paths[@]}"; then
|
if setup_slowdisk_structure "$key" "$static_size_kb" "${static_paths[@]}"; then
|
||||||
tar_extract_opts="-xf - -C / --skip-old-files"
|
# and --keep-directory-symlink so tar extracts THROUGH the pre-created dir symlinks
|
||||||
|
# instead of trying to mkdir over them (which fails with 'Cannot mkdir: File exists')
|
||||||
|
tar_extract_opts="-xf - -C / --skip-old-files --keep-directory-symlink"
|
||||||
echo "SLOWDISK structure ready, will extract respecting symlinks"
|
echo "SLOWDISK structure ready, will extract respecting symlinks"
|
||||||
else
|
else
|
||||||
echo "Warning: Failed to setup SLOWDISK structure, falling back to normal extraction"
|
echo "Warning: Failed to setup SLOWDISK structure, falling back to normal extraction"
|
||||||
@@ -538,6 +541,15 @@ main() {
|
|||||||
# Set up cleanup trap
|
# Set up cleanup trap
|
||||||
trap cleanup_all_ports EXIT INT TERM
|
trap cleanup_all_ports EXIT INT TERM
|
||||||
|
|
||||||
|
# RETH GUARD: reth refuses to start when its static_files directory is a symlink.
|
||||||
|
# Match restore-volumes.sh: skip the whole /slowdisk static-file symlink offload
|
||||||
|
# for reth nodes and extract everything onto the primary disk.
|
||||||
|
if [[ "$1" == *reth* ]]; then
|
||||||
|
echo "WARNING: $1 contains 'reth' — static-file symlink offload disabled (reth broke whole-dir symlinks)"
|
||||||
|
echo " All volumes will be extracted onto the primary disk (equivalent to --no-slowdisk)"
|
||||||
|
NO_SLOWDISK=true
|
||||||
|
fi
|
||||||
|
|
||||||
setup_ssh_multiplex
|
setup_ssh_multiplex
|
||||||
|
|
||||||
# Check if backup directory exists
|
# Check if backup directory exists
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ transfer_volume() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local folder_size=$(du -sb "$source_folder" 2>/dev/null | awk '{print $1}')
|
local folder_size=$(du -sb "$source_folder" 2>/dev/null | awk '{print $1}')
|
||||||
local tar_extract_opts="-xf - -C /"
|
local tar_extract_opts="-xf - -C / --keep-directory-symlink"
|
||||||
local use_slowdisk=false
|
local use_slowdisk=false
|
||||||
|
|
||||||
# Check for SLOWDISK mode and detect static files
|
# Check for SLOWDISK mode and detect static files
|
||||||
@@ -297,7 +297,9 @@ transfer_volume() {
|
|||||||
if setup_slowdisk_structure "$key" "$static_size_kb" "${static_paths[@]}"; then
|
if setup_slowdisk_structure "$key" "$static_size_kb" "${static_paths[@]}"; then
|
||||||
use_slowdisk=true
|
use_slowdisk=true
|
||||||
# Use --skip-old-files to avoid overwriting existing symlinks/directories
|
# Use --skip-old-files to avoid overwriting existing symlinks/directories
|
||||||
tar_extract_opts="-xf - -C / --skip-old-files"
|
# and --keep-directory-symlink so tar extracts THROUGH the pre-created dir symlinks
|
||||||
|
# instead of trying to mkdir over them (which fails with 'Cannot mkdir: File exists')
|
||||||
|
tar_extract_opts="-xf - -C / --skip-old-files --keep-directory-symlink"
|
||||||
echo "SLOWDISK structure ready, will extract respecting symlinks"
|
echo "SLOWDISK structure ready, will extract respecting symlinks"
|
||||||
else
|
else
|
||||||
echo "Warning: Failed to setup SLOWDISK structure, falling back to normal extraction"
|
echo "Warning: Failed to setup SLOWDISK structure, falling back to normal extraction"
|
||||||
@@ -457,7 +459,7 @@ transfer_volume_ssh() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
local folder_size=$(du -sb "$source_folder" 2>/dev/null | awk '{print $1}')
|
local folder_size=$(du -sb "$source_folder" 2>/dev/null | awk '{print $1}')
|
||||||
local tar_extract_opts="-xf - -C /"
|
local tar_extract_opts="-xf - -C / --keep-directory-symlink"
|
||||||
|
|
||||||
# Check for SLOWDISK mode and detect static files (same logic as transfer_volume)
|
# Check for SLOWDISK mode and detect static files (same logic as transfer_volume)
|
||||||
if check_slowdisk_enabled; then
|
if check_slowdisk_enabled; then
|
||||||
@@ -475,7 +477,9 @@ transfer_volume_ssh() {
|
|||||||
echo "Setting up SLOWDISK structure on target..."
|
echo "Setting up SLOWDISK structure on target..."
|
||||||
# Setup slowdisk structure on remote
|
# Setup slowdisk structure on remote
|
||||||
if setup_slowdisk_structure "$key" "$static_size_kb" "${static_paths[@]}"; then
|
if setup_slowdisk_structure "$key" "$static_size_kb" "${static_paths[@]}"; then
|
||||||
tar_extract_opts="-xf - -C / --skip-old-files"
|
# and --keep-directory-symlink so tar extracts THROUGH the pre-created dir symlinks
|
||||||
|
# instead of trying to mkdir over them (which fails with 'Cannot mkdir: File exists')
|
||||||
|
tar_extract_opts="-xf - -C / --skip-old-files --keep-directory-symlink"
|
||||||
echo "SLOWDISK structure ready, will extract respecting symlinks"
|
echo "SLOWDISK structure ready, will extract respecting symlinks"
|
||||||
else
|
else
|
||||||
echo "Warning: Failed to setup SLOWDISK structure, falling back to normal extraction"
|
echo "Warning: Failed to setup SLOWDISK structure, falling back to normal extraction"
|
||||||
@@ -513,6 +517,15 @@ main() {
|
|||||||
# Set up cleanup trap
|
# Set up cleanup trap
|
||||||
trap cleanup_all_ports EXIT INT TERM
|
trap cleanup_all_ports EXIT INT TERM
|
||||||
|
|
||||||
|
# RETH GUARD: reth refuses to start when its static_files directory is a symlink.
|
||||||
|
# Match restore-volumes.sh: skip the whole /slowdisk static-file symlink offload
|
||||||
|
# for reth nodes and extract everything onto the primary disk.
|
||||||
|
if [[ "$1" == *reth* ]]; then
|
||||||
|
echo "WARNING: $1 contains 'reth' — static-file symlink offload disabled (reth broke whole-dir symlinks)"
|
||||||
|
echo " All volumes will be extracted onto the primary disk (equivalent to --no-slowdisk)"
|
||||||
|
NO_SLOWDISK=true
|
||||||
|
fi
|
||||||
|
|
||||||
setup_ssh_multiplex
|
setup_ssh_multiplex
|
||||||
|
|
||||||
# the following sysctls are critical for high-latency networks
|
# the following sysctls are critical for high-latency networks
|
||||||
|
|||||||
Reference in New Issue
Block a user