Migrating a Plex Media Server to another system

Note: This is a how-to for migrating a Plex Media Server from one Linux system to another Linux system. This is not about changing platforms.

Recently I migrated my ProxMox virtualization host from a dual Xeon system (HP Z600) to a dual Opteron 6278 system to have more cores. One of the VMs to be migrated was a Plex Media Server instance.

Both the origin and destination systems are Fedora 27 Server, but this should also work across distributions. As you’ll see, it’s quite easy.

Backing up the server

First step is to back up the library on the original server. As root or an administrator, after stopping Plex Media Server:

cd /var/lib
sudo tar cvf plexmediaserver.tar plexmediaserver/
gzip plexmediaserver.tar

This should give you a .tar.gz backup of your Plex instance. I have a pretty large library – over 300 movies and specials, over 300 music albums, and 29 TV shows, most of which are complete series (and yes, I own physical copies or licenses to everything on it) – so my backup ended up being about 1.5GB. Your mileage may vary.

My Plex server pulled from NFS shares on my NAS, so I made sure to also copy off the relevant fstab entries so I could restore them.

Transfer the backup file off the server somehow and shut it down.

On the new server

On the new server or virtual machine with Linux installed and updated, install Plex Media Server but do NOT start it. Instead run these commands:

cd /var/lib
rm -rf plexmediaserver #Don't worry, it's empty.
cp path/to/plexmediaserver.tar.gz .
sudo tar xvfz plexmediaserver.tar.gz

Make sure to also restore the links to any network shares. Now you can start the new server:

sudo systemctl enable plexmediaserver #if you haven't yet done this
sudo systemctl start plexmediaserver

Make sure to add the needed ports to your firewall: you must open 32400/TCP, and if you intend to use DLNA, you need to open 1900/UDP and 32469/TCP.

Log into the Plex server when you’re done and try playing something to verify everything works. It should be exactly as you left it. And any DLNA links on media players should still work as the UUID for the server should have been retained. Be sure to delete the .tar.gz file after confirming your Plex server works as expected.