System Maintenance
Keep your Borg UI installation healthy with regular maintenance tasks.Database Migrations
Borg UI uses an automatic migration system to upgrade the database schema across versions.How Migrations Work
Automatic execution (fromapp/database/migrations/__init__.py:12-55):
- On startup, Borg UI scans
/app/database/migrations/for numbered migration files - Files are executed in order:
001_*.py,002_*.py, …,072_*.py - Each migration is idempotent - safe to run multiple times
- Checks for existing columns/tables before adding
- Logs success/failure for each migration
Migration Files
As of latest version, 72 migrations are included: Recent migrations:072_add_mqtt_base_topic.py- MQTT base topic configuration070_add_source_size_timeout.py- Source size calculation timeout069_add_bypass_lock_on_list.py- Bypass lock for list operations066_add_ssh_path_prefix.py- SSH path prefix support061_add_bypass_lock_on_info.py- Bypass lock for info operations053_add_operation_timeouts.py- Configurable operation timeouts040_add_cache_settings.py- Redis cache configuration
053_add_operation_timeouts.py:13-68):
Monitoring Migrations
View migration logs on startup:Manual Migration Rollback
If you must rollback:- Restore from database backup:
- Manual SQL rollback (advanced):
SQLite does not support
DROP COLUMN. You must recreate the table without the column and migrate data.Database Backups
Automatic Backups
Backup before updates:Manual Backups
Online backup (recommended):Scheduled Backups
Using cron:Database Restore
Restore from backup:Log Management
Borg UI includes automatic log rotation with configurable retention and size limits.Log Storage
Log locations:- Job logs:
/data/logs/backup_job_*.log,/data/logs/restore_job_*.log, etc. - Application log:
/data/logs/borg-ui.log - Docker logs:
docker logs borg-web-ui
app/services/log_manager.py:32-39):
Automatic Log Rotation
How it works (app/services/log_manager.py:352-432):
- Age-based cleanup: Delete logs older than configured days
- Size-based cleanup: Delete oldest logs if total size exceeds limit
- Protected logs: Running jobs’ logs are never deleted
- Combined cleanup: Both age and size limits enforced
- Log Retention Days: 7, 14, 30, 60, 90 days (default: 30)
- Max Total Log Size: 100-5000 MB (default: 500 MB)
- Before each backup (in
backup_service.rotate_logs()) - Manually via Settings → System → Cleanup Logs
Manual Log Cleanup
View log storage:Log Rotation Configuration
Via database migration (033_add_log_management_settings.py):
app/services/log_manager.py:116-146):
Database Maintenance
Optimize Database
VACUUM (reclaim space):Check Database Integrity
Quick check:Repair Corrupted Database
Attempt repair:Repository Maintenance
Compact Repositories
Purpose: Reclaim space from deleted archives (after prune operations). Via UI:- Go to Repository → Maintenance
- Click Compact Repository
- Wait for completion (can take hours for large repos)
- After pruning archives
- When repository shows “sparse” disk usage
- To reclaim significant space
Check Repositories
Verify repository integrity:Prune Archives
Configure retention policy: Via UI: Repository → Settings → Prune Policy- Keep last 7 daily backups
- Keep last 4 weekly backups
- Keep last 12 monthly backups
- Keep last 7 yearly backups
System Updates
Update Borg UI
Recommended update process:Rollback After Failed Update
If update fails:Maintenance Schedule
Daily Tasks
Automated daily maintenance
Automated daily maintenance
These run automatically:
- ✅ Log rotation (before each backup)
- ✅ Scheduled backups (if configured)
- ✅ Scheduled repository checks (if configured)
Weekly Tasks
Recommended weekly tasks
Recommended weekly tasks
Perform weekly:
- Check logs for errors:
- Verify recent backups:
- Review disk space:
- Check cache statistics:
Monthly Tasks
Monthly maintenance checklist
Monthly maintenance checklist
- Database backup:
- Database optimization:
- Repository checks:
- Review and clean old logs:
- Update Borg UI:
Quarterly Tasks
Quarterly deep maintenance
Quarterly deep maintenance
- Test disaster recovery:
- Audit user accounts:
- Review and update schedules:
- Performance review:
- Security audit:
Maintenance Scripts
All-in-One Maintenance Script
Related Documentation
Troubleshooting
Common maintenance issues and fixes
Performance
Database and cache optimization
Security
Database backup encryption
Configuration
Log and backup settings