feat: Add configurable shared backup directory and enhance backup script with improved storage checks

This commit is contained in:
Peter Wood
2025-12-13 16:41:05 -05:00
parent e8ce1f192f
commit 7cbd2779a5
3 changed files with 40 additions and 26 deletions

View File

@@ -56,7 +56,7 @@ Complete backup script for Immich installation that creates backups of:
**Backup Location:**
**Primary Storage:** `/mnt/share/media/backups/immich/` (shared storage)
**Primary Storage:** Configurable via `SHARED_BACKUP_DIR` in `.env` (default: `/mnt/share/media/backups/immich/`)
- Database: `immich_db_backup_YYYYMMDD_HHMMSS.sql.gz`
- Uploads: `immich_uploads_YYYYMMDD_HHMMSS.tar.gz`
@@ -66,17 +66,20 @@ Complete backup script for Immich installation that creates backups of:
**Backup Workflow:**
1. **Create local backups** in temporary directory (`../immich_backups/`)
2. **Copy to shared storage** (`/mnt/share/media/backups/immich/`)
2. **Copy to shared storage** (configured via `SHARED_BACKUP_DIR`)
3. **Upload to Backblaze B2** (if configured)
4. **Delete local copies** (shared storage copies retained)
**Features:**
- **Smart backup workflow**: Creates → Copies to shared storage → Uploads to B2 → Cleans up locally
- **Configurable Storage**: Support for custom shared storage paths via `.env`
- **Robust B2 Support**: Automatically detects system-installed `b2` CLI or local binary
- Command-line options for flexible operation (--help, --dry-run, --no-upload, --verbose)
- Dry-run mode to preview operations without executing
- Option to skip B2 upload for local-only backups
- **Shared storage integration**: Automatically copies backups to `/mnt/share/media/backups/immich/`
- **Shared storage integration**: Automatically copies backups to shared storage
- **Safety Checks**: Verifies mount points and storage availability before writing
- **Local cleanup**: Removes temporary files after successful copy to shared storage
- Automatic container pausing/resuming during backup
- Comprehensive error handling and cleanup
@@ -158,11 +161,11 @@ Container Status Check:
B2 Upload Configuration:
✓ B2 configured - would upload to bucket: my-immich-backups
✓ B2 CLI found at: /home/acedanger/shell/immich/b2-linux
✓ B2 CLI found at: /usr/bin/b2
Shared Storage Check:
✓ Shared storage accessible: /mnt/share/media/backups
✓ Shared storage writable - would copy backups before B2 upload
✓ Shared storage writable - would copy backups to /mnt/share/media/backups/immich/
=== DRY RUN COMPLETE - No files were created or modified ===
```