Backing Up PLEX

  • Stop Plex Media Server
sudo systemctl stop plexmediaserver.service
  • Create the backup
tar cfz /backup/plexmediaserver.tar.gz /var/lib/plexmediaserver/Library
  • Start Plex Media Server
sudo systemctl start plexmediaserver.service
  • Back up complete!

Restoring a BackUp of Plex

  • Assumes you have a working copy of Plex Media Server already installed with your media files in the same directories as before. Install

  • Stop PMS

sudo systemctl stop plexmediaserver.service
  • Restore the backup by replacing the existing /var/lib/plexmediaserver/Library with the backup copy.
sudo rm -rf /var/lib/plexmediaserver/Library
sudo tar xf /backup/plexmediaserver.tar.gz /var/lib/plexmediaserver/Library
  • Start Plex Media Server
sudo systemctl start plexmediaserver.service
  • Check Libraries and their locations
  • Restore complete!

Moving PLEX

  • Install Plex Media Server on the target server.
  • Start and Stop PMS on the new target server (no interaction is required)
sudo systemctl start plexmediaserver.service
sudo systemctl stop plexmediaserver.service
  • Prepare Plex Media Server for the move
    In the web interface (GUI) of the source server, Settings->Library, ensure Empty trash automatically after every scan is unchecked
    Save Settings
    This will ensure no data is removed if your media libraries are not mapped correctly on start up.
  • Stop PMS on the source server
sudo systemctl stop plexmediaserver.service

Replace the target /var/lib/plexmediaserver/Library directory with a copy of the source /var/lib/plexmediaserver/Library directory.

sudo rm -rf /var/lib/plexmediaserver/Library
sudo scp -av /var/lib/plexmediaserver/Library target_server:/var/lib/plexmediaserver/

Alternatively, use rsync.

sudo rsync --delete --recursive --perms --times --links --progress  --human-readable --itemize-changes --verbose  --stats --owner --group /var/lib/plexmediaserver/Library  target_server:/var/lib/plexmediaserver/Library
  • NOTE: Due to the very large amount of small files, scp, copy and rsync will take a while! Creating an archive file using tar, moving the file, then unpacking the file will likely be quicker!
  • If Cloning, see notes below before preceding!!!
  • Start Plex Media Server on the target server.
sudo systemctl start plexmediaserver.service
  • Check Libraries and their locations
  • Uninstall Plex Media Server from the source server, purging files (if required) from /var/lib/plexmediaserver/
  • Move complete!

Cloning PLEX

  • Cloning is very similar to Moving Plex with attention to the following differences:
    • Immediately after copying the data files to /var/lib/plexmediaserver/Library, before starting Plex Media Service, DELETE the Preferences.xml file.
sudo rm /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml
  • When you start Plex Media Server, the Start Up Wizard will run.
    • A new instance with a new machine ID will be created
    • Give your server a unique name
    • Create your Libraries
    • Edit all your Preferences

Housekeeping after Restoring, Moving or Cloning!

  • If you originally disabled the Empty trash automatically after every scan in any Library, you can turn that back on now.
  • Empty Trash for all libraries. This must be performed for each library separately.
  • Settings -> Troubleshooting -> Clean Bundles for the server (wait at least a couple of minutes even after the dialog box goes away before proceeding)
  • Settings -> Troubleshooting -> Optimize Database for the server

Sources:

Plex Support: Move an Install to Another System
Backup Restore Clone Plex