Plex Migration

Probably the easiest way to deploy Plex is using their docker image. Such an instance is also easy to migrate, this is what I recently did. Stop the container, atchive the directory containing the volume(s) and copy it to your new server. There is just one important thing which can make your migration not smooth: sometimes Preferences.xml gets overwritten during the first startup of the migrated container. If that happens your installation won’t work and most likely you’ll end up with the “Not authorized” message when accessing http://yourhost:32400/web.

So make sure your “Plex_Media_Server/Library/Application Support/Plex Media Server/Preferences.xml” it is the same on the source and the destination. You can reuse your plex claim, just stop the original container before starting the new one.

Migration steps:

  • Copy the media library: destination% scp -r source:/data/library /data/library/ Depending on the size of your library this might take awhile, hours, days, run the process from tmux/screen.
  • Stop the container, archive the data and copy it to the new server:
source% sudo docker stop plex
source% tar czvf /tmp/plex.tar.gz /data/plex

Make sure to create a plex group and user on your server (outside of the container) using the same gid and uid as on the source.

destination% sudo groupadd -g 1001 plex
destination% sudo adduser -u 1001 plex
destination% sudo usermod -aG plex plex
destination% scp source:/tmp/plex.tar.gz /tmp/
destination% cd /tmp && tar xzvf /tmp/plex.tar.gz
destination% sudo mv data/plex /data/
destination% sudo chown -R plex:plex /data
destination% sudo chown -R plex:plex /data/library
destination% sudo docker-compose -f ~/docker/plex/docker-comopse.yml up -d
destination% sudo docker-compose -f ~/docker/plex/docker-comopse.yml logs -f

If all went well ayou should be able to see your library in Plex, as nothing has changed.

Here is an example docker-compose.yml file. It is a good idea to have the same pms-docker version as on the source. You can update it later.

---
version: '3.3'
services:
  plex:
    container_name: plex
    #image: plexinc/pms-docker: latest
    image: plexinc/pms-docker:1.32.8.7639-fb6452ebf
    restart: unless-stopped
    environment:
      - PLEX_UID=1001
      - PLEX_GID=1001
      - TZ=UTC
      - PLEX_CLAIM=claim-yourclaim
    network_mode: host
    volumes:
      - /data/plex/Plex_Media_Server:/config
      - /data/plex/temp:/transcode
      - /mnt/plex_library:/data

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.