v0.12.6: fix rsync destination nesting and exclude app-internal DB dumps
Two rsync bugs found during Immich cross-drive backup testing: Fix 3: Simplified destination path structure in runRsyncBackup. Old SplitN logic kept "storage/immich" as a subpath, creating redundant nesting: backups/rsync/immich/storage/immich/<data>. New logic: single mount → rsync directly into the stack folder; multiple mounts → use each mount's leaf dir name as subfolder (disambiguated by _N suffix). Fix 4: Exclude app-internal DB dump files from rsync. Apps like Immich store periodic pg_dumps in <data>/backups/*.sql.gz. The controller already handles DB backups via pg_dump — copying them again wastes space. Added --exclude backups/*.sql.gz/sql/dump to the rsync command. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,25 @@
|
||||
## Changelog
|
||||
|
||||
### What was just completed (2026-02-18 session 42)
|
||||
- **v0.12.6 — Cross-Drive Backup Rsync Fixes:**
|
||||
|
||||
**Context:** After fixing mount-point validation and system-drive thresholds (v0.12.5), testing revealed two more rsync issues for Immich.
|
||||
|
||||
**Fix 3: Simplified rsync destination path structure (`internal/backup/crossdrive.go` `runRsyncBackup`)**
|
||||
- Old logic stripped only the first 2 path segments and kept the rest as a subpath, producing redundant nesting: `backups/rsync/immich/storage/immich/<data>` instead of `backups/rsync/immich/<data>`
|
||||
- New logic: if app has a single mount, rsync directly into the stack folder (`backups/rsync/immich/`); if multiple mounts, use each mount's leaf directory name as subfolder
|
||||
- Duplicate leaf names disambiguated by appending `_N` index suffix
|
||||
- Loop variable changed from `_, srcMount` to `i, srcMount` to support the index-based disambiguation
|
||||
- Old nested `storage/immich/` folder will remain orphaned after first run (no data loss; `--delete` only affects the target subtree)
|
||||
|
||||
**Fix 4: Exclude app-internal DB dump files from rsync (`internal/backup/crossdrive.go` `runRsyncBackup`)**
|
||||
- Apps like Immich store their own periodic DB dumps in `<data>/backups/*.sql.gz` (~16 MB/day)
|
||||
- The controller already handles DB backups via `pg_dump` separately — copying these again via rsync is redundant and wastes space
|
||||
- Added `--exclude backups/*.sql.gz`, `--exclude backups/*.sql`, `--exclude backups/*.dump` to rsync command
|
||||
- The `backups/` directory itself and non-dump files within it are preserved
|
||||
|
||||
**Files modified (1):** `internal/backup/crossdrive.go`
|
||||
|
||||
### What was just completed (2026-02-18 session 41)
|
||||
- **v0.12.5 — Cross-Drive Backup Validation Fix:**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user