Having had a wee issue with Jellyfin Media Server’s database this week after an upgrade, I decided to avoid the requirement for a 24 hour database rebuild, to start backing things up with Borgmatic. Borgmatic is a handy wrapper script to automate BorgBackup.
location: # List of source directories to backup. source_directories: - /etc/jellyfin - /var/lib/jellyfin # Path to BorgBackup repository repositories: - /export/ServerData/jellyfin_database retention: # Retention policy for how many backups to keep. keep_daily: 7 consistency: # List of checks to run to validate your backups. checks: - repository - archives hooks: # Custom preparation scripts to run. before_backup: - systemctl stop jellyfin after_backup: - systemctl start jellyfin
This is a very simple configuration, which does the following steps:
- Stops the Jellyfin server
- Runs Borg on both configuration directories – /etc/jellyfin & /var/lib/jellyfin.
- Checks the repo & existing archives for consistency
- Restarts the Jellyfin server.
Now, whenever the SQLite 🤮 databases backing up the frontend decide to have a shitfit, it should be a relatively simple matter to restore to the last good backup. In my case I have a cronjob set to run every night. Once someone adds proper MySQL support, I will migrate over to a proper database server instance. 😉
How would one go about restoring?