How to Migrate a Plex Server to a New Server (Ubuntu/Linux)
This guide outlines the steps to migrate a Plex Media Server from one Ubuntu server to another while preserving your library data, watch history, and metadata.
Prerequisites
- Access: Root or sudo access to both the Source (Old) and Destination (New) servers.
- Media: Your actual media files (Movies, TV) must be at the exact same mount path on the new server as they were on the old one. If they change location, you will need to remap them later.
- Versions: Ensure both servers are running the same version of Plex Media Server to avoid database compatibility issues.
Step 1: Preparation on Source Server
Disable “Empty Trash”:
- Open Plex Web.
- Go to Settings > Library.
- Disable “Empty trash automatically after every scan”.
- Reason: This prevents Plex from deleting your metadata if it temporarily can’t find your media files during the move.
Stop Plex Service:
sudo systemctl stop plexmediaserver
Step 2: Backup Data (Source)
The critical data is located in /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/.
Archive the Data: We will create a compressed archive of the Application Support directory. This preserves permissions and symlinks.
cd /var/lib/plexmediaserver/Library/Application Support/ sudo tar -czf ~/plex_backup.tar.gz "Plex Media Server"Note: This file can be very large depending on your library size (especially if video previews are enabled).
Backup Preferences: The
Preferences.xmlfile contains your server identity. It is included in the folder above, but verifying its existence is good practice.Location:
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml
Step 3: Preparation on Destination Server
Install Plex Media Server: Download and install the
.debpackage from the official Plex website, or use the repository.# Example (Check plex.tv/downloads for the latest URL) wget https://downloads.plex.tv/plex-media-server-new/1.x.x.x/debian/plexmediaserver_1.x.x.x_amd64.deb sudo dpkg -i plexmediaserver_*.debStop Plex Service: The installation automatically starts the service. We must stop it to overwrite the data.
sudo systemctl stop plexmediaserverBackup Original Data (Optional): Move the fresh (empty) installation data aside just in case.
cd /var/lib/plexmediaserver/Library/Application Support/ sudo mv "Plex Media Server" "Plex Media Server.original"
Step 4: Transfer and Restore
Transfer the Archive: From the Source server, use
scp(orrsync) to copy the backup to the Destination server.# Run this on the SOURCE server scp ~/plex_backup.tar.gz user@new-server-ip:~/Extract on Destination: On the Destination server, extract the archive to the correct location.
# Run this on the DESTINATION server sudo tar -xzf ~/plex_backup.tar.gz -C /var/lib/plexmediaserver/Library/Application Support/
Step 5: Fix Permissions
Using tar usually preserves permissions, but it is critical to ensure the plex user owns the files.
sudo chown -R plex:plex /var/lib/plexmediaserver
Step 6: Start and Verify
Start Plex:
sudo systemctl start plexmediaserverVerify Access:
- Open a web browser and go to
http://<new-server-ip>:32400/web. - You may need to sign out and sign back in to reclaim the server.
- Check that your libraries appear and your “On Deck” / “Continue Watching” status is intact.
- Open a web browser and go to
Cleanup:
- Re-enable “Empty trash automatically after every scan” in Settings > Library.
- (Optional) Delete the
plex_backup.tar.gzfile once you are confident everything is working.











Comments