Table of Contents
Syncing a Jellyfin server from Linux to macOS
The purpose of this guide is to move an existing Jellyfin instance running on Linux to macOS, and prepare everything so that it works with Jellyfin.app.
Prerequisites
- Jellyfin.app (the server application)
brew install --cask jellyfin
- GNU versions of some common tools
brew install findutils gnu-sed
Copying and fixing the configuration and metadata
- Copy over everything relevant
rsync -avhH --delete --bwlimit=24M --info=progress2 user@linux:/var/log/jellyfin/ /Volumes/pinky/couch/var/log/jellyfin/; \ rsync -avhH --delete --bwlimit=24M --info=progress2 user@linux:/etc/jellyfin/ /Volumes/pinky/couch/etc/jellyfin/; \ rsync -avhH --delete --bwlimit=24M --info=progress2 user@linux:/var/lib/jellyfin/ /Volumes/pinky/couch/var/lib/jellyfin/; \ rsync -avhH --delete --bwlimit=24M --info=progress2 user@linux:/var/cache/jellyfin/ /Volumes/pinky/couch/var/cache/jellyfin/
- You can't use locations like
/var/libto store Jellyfin data on macOS. Therefore we'll have to change those paths.gfind -L . \( -name \*.xml -o -name \*.json \) -exec gsed -i 's:/var/lib/jellyfin/:/Volumes/pinky/couch/var/lib/jellyfin/:g' {} + ; \ gfind -L . \( -name \*.xml -o -name \*.json \) -exec gsed -i 's:/var/cache/jellyfin/:/Volumes/pinky/couch/var/cache/jellyfin/:g' {} +
Linking the application config to the backup
- Run Jellyfin.app once to create the folder, then quit it.
- There should be a folder
~/Library/Application Support/jellyfin, but it might also be created in~/.local/share/jellyfin. Find out and go there. - Delete all the folders except for
cacheand replace them with symbolic links:cd ~/Library/Application\ Support/jellyfin ln -s /Volumes/pinky/couch/var/lib/jellyfin/root ./ ln -s /Volumes/pinky/couch/var/lib/jellyfin/plugins ./ ln -s /Volumes/pinky/couch/var/lib/jellyfin/metadata ./ ln -s /Volumes/pinky/couch/var/lib/jellyfin/data ./ ln -s /Volumes/pinky/couch/etc/jellyfin ./config ln -s /Volumes/pinky/couch/var/log/jellyfin ./log
Mounting and linking the media folder
If the media is not also stored on your Mac, you'll have to mount it via the Finder or a command:
mount -t smbfs //user:password@192.168.0.512/Jellyfin ~/Documents/jellyfin
This has to be run after every reboot or network disconnect, before you run the Jellyfin server. There might be a smarter way to automate the mounting and, if necessary, re-mounting.
Linking the media folder to a "forbidden" path
Let's assume your media files were located under /monty/ on the Linux server, and this is where Jellyfin will still expect them. We can't usually create folders or files in the root folder on macOS to recreate this, and we don't want to destroy and recreate all the libraries to match a new path. Instead, we are going to create a synthetic link that points to the library – or in this case, the SMB share we just mounted.
- (Create and) Insert a line into
synthetic.confso you can put a link called “monty” to the mounted folder in/:monty /Users/username/Documents/jellyfin
- This configuration will be loaded after rebooting, or we can just run:
/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t
There will now be a link/montypointing to~/Documents/jellyfinwhich is where we mounted the folder containing the media. This matches where we stored it before and Jellyfin is happy.
