This guide explains how to backup and restore your Youtarr installation, enabling disaster recovery and migration to new systems.
- Docker and Docker Compose (for database operations)
jqcommand-line JSON processor (for parsing backup manifest)tarandgzip(standard on most systems)
On Debian/Ubuntu, install jq with: sudo apt install jq
# Full backup to default location ./backups/
./scripts/backup.sh
# Backup to custom location
./scripts/backup.sh --output-dir /mnt/external/backups
# Skip thumbnails (they auto-regenerate)
./scripts/backup.sh --skip-images# Stop Youtarr first
./stop.sh
# Restore from backup
./scripts/restore.sh ./backups/youtarr-backup-20240115-120000.tar.gz
# Start Youtarr
./start.sh| Component | Path | Criticality | Typical Size |
|---|---|---|---|
| Environment config | .env |
Critical | ~1KB |
| App settings | config/config.json |
Critical | ~2KB |
| YouTube cookies | config/cookies.user.txt |
High (if exists) | ~8KB |
| Download history | config/complete.list |
Critical | ~2KB |
| Database | MariaDB dump | Critical | Variable |
| Video metadata | jobs/info/*.info.json |
Critical | Variable |
| Thumbnails | server/images/* |
Optional | Variable |
Note: Video metadata files are critical because they cannot be regenerated - they're only created during the initial download. Thumbnails are optional because they auto-regenerate when channels are accessed.
Video files in YOUTUBE_OUTPUT_DIR are NOT included - these must be backed up separately by you. This is intentional because:
- Video files can be very large (hundreds of GB to TB)
- They're typically stored on external/NAS storage
- They can be re-downloaded if lost (though this takes time)
./scripts/backup.shCreates a complete backup including metadata and thumbnails. Best for full disaster recovery.
Typical size: 10-200MB depending on your library size
./scripts/backup.sh --skip-imagesSkips channel thumbnail images to reduce backup size. Thumbnails auto-regenerate when channels are accessed, so this is safe to use.
./scripts/backup.sh --output-dir /mnt/backup/youtarrSaves the backup to a different directory (default is ./backups/).
./scripts/restore.sh backup.tar.gzRestores everything from the backup. You'll be prompted to type RESTORE (case-sensitive) to confirm.
Important notes:
- The database is completely replaced (DROP + CREATE) - this is not a merge
- The script may use
sudoautomatically for files with restricted permissions - On non-ARM systems, the existing
database/directory is cleared before import
./scripts/restore.sh backup.tar.gz --skip-dbRestores only configuration files, skipping the database. Useful when:
- Database is on an external server
- You only want to restore settings
./scripts/restore.sh backup.tar.gz --forceSkips the confirmation prompt. Use with caution in scripts.
-
On the old computer:
./scripts/backup.sh --output-dir /mnt/external
-
Copy your video files from
YOUTUBE_OUTPUT_DIRto the new location -
On the new computer:
git clone https://github.com/DialmasterOrg/Youtarr.git cd Youtarr ./scripts/restore.sh /path/to/youtarr-backup.tar.gz -
Update
.envif your video path has changed:# Edit .env and update YOUTUBE_OUTPUT_DIR to the new path nano .env -
Start Youtarr:
./start.sh
If your system drive fails but your video files survive (on external/NAS storage):
-
Install fresh OS and Docker
-
Clone Youtarr:
git clone https://github.com/DialmasterOrg/Youtarr.git cd Youtarr -
Restore from your offsite backup:
./scripts/restore.sh /path/to/backup.tar.gz
-
Verify video path in
.env:cat .env | grep YOUTUBE_OUTPUT_DIR # Update if the path has changed
-
Start Youtarr:
./start.sh
Your channels, settings, and download history will be restored. Videos should appear since they reference the same output directory.
Same as "Moving to a New Computer" - backup, transfer, restore.
The backup creates a timestamped .tar.gz archive with this structure:
youtarr-backup-YYYYMMDD-HHMMSS/
manifest.json # Backup metadata
env.backup # Your .env file
config/
config.json # Application settings
cookies.user.txt # YouTube cookies (if present)
complete.list # Download history
database/
youtarr.sql # Full database dump
metadata/
jobs/info/ # Video metadata files (always included)
server/images/ # Thumbnail images (unless --skip-images)
Youtarr automatically detects ARM architecture (Apple Silicon, Raspberry Pi) and handles it appropriately:
- Backup: Works the same on all architectures
- Restore: Uses named volumes for MariaDB on ARM (instead of bind mounts)
- Cross-architecture: You can backup on x86 and restore on ARM (or vice versa)
The database dump is architecture-independent SQL, so migrations between architectures work seamlessly.
You can schedule regular backups using cron:
# Edit crontab
crontab -e
# Add daily backup at 3 AM
0 3 * * * /path/to/Youtarr/scripts/backup.sh --output-dir /mnt/backup/youtarrConsider these best practices:
- Store backups on a different drive than your system
- Use
--skip-imagesif you want smaller backups (thumbnails auto-regenerate) - Test restores periodically
The backup script requires Youtarr to be initialized first:
./start.sh # Initialize Youtarr
./stop.sh # Stop it
./scripts/backup.sh # Now backup will workThe database container may take longer to start on some systems:
- Wait a moment and try again
- Check Docker is running:
docker ps - Check for port conflicts on 3321
After restoring, the video path from the backup might not exist on your new system:
- Edit
.envand updateYOUTUBE_OUTPUT_DIRto point to your videos - Or create the directory and copy/mount your videos there
Some files may need elevated permissions:
# Run with sudo if needed
sudo ./scripts/restore.sh backup.tar.gzIf the database import fails:
-
Try starting Youtarr normally (it will create a fresh database):
./start.sh
-
Then try a config-only restore:
./stop.sh ./scripts/restore.sh backup.tar.gz --skip-db ./start.sh
You'll lose your channel subscriptions but keep your settings. Videos will still exist; you'll need to re-add channels.
Backup archives contain sensitive data:
- Database credentials (in
.env) - Plex API keys (in
config/config.json) - YouTube API keys (if configured)
- Session data
Store backups securely and consider encrypting them if storing offsite:
# Create encrypted backup
./scripts/backup.sh
gpg -c backups/youtarr-backup-*.tar.gz
# Decrypt before restore
gpg -d backup.tar.gz.gpg > backup.tar.gz
./scripts/restore.sh backup.tar.gz