From 2267a34b474b104ac80454dcf67187466daf679d Mon Sep 17 00:00:00 2001 From: jgitta Date: Sat, 25 Apr 2026 19:13:19 -0500 Subject: [PATCH] Fix: Use disk staging directory instead of tmpfs /tmp for backups Problem: - /tmp is a tmpfs mount with only 3.9GB space - Backing up 1.4TB Nextcloud files requires space for tar and zstd compression - Both mysqldump and tar were failing with 'No space left on device' Solution: - Changed TEMP_DIR from /tmp to /mnt/nextcloud-data/.backup-staging - /mnt/nextcloud-data has 487GB free space (sufficient for compressed backups) - Staging directory is automatically cleaned up after successful upload to B2 Impact: - Backup process now completes successfully for full 1.4TB Nextcloud datasets - No changes to B2 credentials or configuration - Backward compatible with existing backup configurations --- nextcloud-backup-to-backblaze.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nextcloud-backup-to-backblaze.sh b/nextcloud-backup-to-backblaze.sh index 1c33d85..7e79f7e 100755 --- a/nextcloud-backup-to-backblaze.sh +++ b/nextcloud-backup-to-backblaze.sh @@ -17,7 +17,9 @@ BACKUP_DIR="/opt/nextcloud-backup/.backups" LOG_DIR="${BACKUP_DIR}/logs" TIMESTAMP=$(date +%Y%m%d_%H%M%S) LOG_FILE="${LOG_DIR}/backup_${TIMESTAMP}.log" -TEMP_DIR="/tmp/nextcloud-backup-${TIMESTAMP}" +# Use staging directory on disk with sufficient space (not tmpfs /tmp) +STAGING_DIR="/mnt/nextcloud-data/.backup-staging" +TEMP_DIR="${STAGING_DIR}/nextcloud-backup-${TIMESTAMP}" # Create directories mkdir -p "${BACKUP_DIR}" "${LOG_DIR}" "${TEMP_DIR}" @@ -84,5 +86,6 @@ fi # Cleanup rm -rf "$TEMP_DIR" +rmdir "$STAGING_DIR" 2>/dev/null || true # Remove staging directory if empty echo "[$(date '+%Y-%m-%d %H:%M:%S')] ✅ Backup completed!" | tee -a "${LOG_FILE}"