For those not in the know, Jellyfin is a fantastic OpenSource alternative to Plex. Forked from Emby before they wen't closed-source, Jellyfin offers self-hosters and media enthusiasts total control over their personal media. If you haven't given this software a try I encourage you to take it for a spin sometime.
Recently, I had to migrate my virtual machine that hosts my jellyfin service to a new server. I could not much information on the official website about backup or migration best practices. The only thing I could find from them was how to migrate from Emby to Jellyfin.
First, one must have a running instance of Jellyfin on their new server. If you do not know how to do that, please check out the official documentation.
On your new server begin by stopping the service.
sudo systemctl stop jellyfin.service
Next, trick the system by setting the StartUpWizrd from false to true. This will prevent your system from needing to do a First Time Setup wizrd. This is very important to do otherwise someone could setup this after the fact easily and ruin your day. Extra important if you expose your sever externally.
sudo sed -i '/IsStartupWizardCompleted/s/false/true/' /etc/jellyfin/system.xml
Then, from your old server, create a backup archive of the local databases and then transfer that to your new server.
sudo tar cvzf jellyfin.tar.gz /var/lib/jellyfin # Where $USER = a valid user on the target server # $HOST = the ip or fqdn of your new server scp jellyfin.tar.gz $USER@$HOST:/tmp
Lastly, extract the backed up contents and start the service back up.
sudo tar -xvzf /tmp/jellyfin.tar.gz -C / sudo systemctl start jellyfin.service
You should now be able to sign into your new server with all of the previous credentials and watch data in tact!
Note: if you changed any of the mount point locations the metadata will be messed up and the library needs to be completely re-added.
For example, during my migration I changed the mount point of my library from /mnt/nfs/media to /data/media and had to completely remove the library and add it back for jellyfin to be able to play the content again. This also incurred a full re-scan of all my content. Watch out!