Best way to migratePlex server from DSM7 to Docker

I want to move my existing Plex server from Synology DSM6 to a docker container hosted on Debian.

I will continue to host the media on the Synology NAS.

What’s the best way to do this? Is it even possible? Or would it be simpler to start over. This is a PlexPass account if that makes a difference.

Thank you!

It’s a bit tricky but can be done.

  1. make sure you have NFS enabled on the Syno (file services)
  2. also make sure you have nfs-common installed on the debian host.
  3. make the directory on the host where /config will be mapped.
    ( I’ll use ‘/dockerplex’ in this example. Edit appropriately)
  4. Mount and suck across the entire Plex shared folder
sudo bash
# Make the container's map point

mkdir /dockerplex

mount lan.ip.of.syno:/volume1 /mnt
cd /mnt/Plex

# Mass copy 
tar cf - . | (cd /dockerplex ; tar xf -) 

# If you're changing uid/gid,  fix it now
chown -R  newUID:newGID /dockerplex

umount /mnt
  1. Make directories for where each share from the syno will mount.
sudo bash
mkdir /syno
mkdir /syno/volume1  /syno/volume2   (add one for each volume)
chmod 755 -R /syno

  1. Setup /etc/fstab (Showing NFS here – which is the easiest)
lan.ip.of.syno:/volume1    /syno/volume1    nfs defaults,auto,rw,sec=sys 0 0
lan.ip.of.syno:/volume2    /syno/volume2    nfs defaults,auto,rw,sec=sys 0 0
  1. Here’s the magic for in the container: (the media volume mapping)
    This keeps the environment inside the container exactly as it was native on the syno.

-v /syno/volume1:/volume1
-v /syno/volume2:/volume2

  1. Add the mapping for /config

-v /dockerplex:/config

Look through that. I might have missed a few details but that’s the bulk and trickiest part of bring it over.

The key to this is the Syno installation won’t even know it was moved because all the pathnames are unchanged (from the container’s perspective)

Thanks for this.

Instead of NFS, I’ll be using cifs. I’ve already mapped the Synology media drive to Debian, so that part is good.

I read somewhere that only the Media, Metadata, Plug-in Support, and Plug-ins folders need to be migrated, yet you say bring it all. What is difference? Do I need Cache, Codecs, Crash Reports, Diagnostics, and Logs from the Synology installation? Not trying to be argumentative, just learning here.

I’ll give this a go early next week.

WHY?

Both are native Linux machines but you want to use a Microsoft protocol and not the native NFS (Linux) protocol ?

NFS is a LOT faster and easier (and supports multiple concurrent usernames) than CIFS on Linux

By performing a full map, you won’t need to edit the shared folders ( a typical required step ) after you migrate.

You’ll still have the same amount of data in the end but why waste the time rebuilding it , and the manual labor, if you can just copy it and be smart about it ?

This is the one advantage of moving Linux → Linux AND being in a container.

The container can emulate the Synology fileystem :slight_smile:

To put this in perspective, total time for this task should be:

  1. Time for the tar copy of all the data to complete
  2. Add 15 minutes to setup the local linux host for the NFS mount points
  3. 5 minutes to configure the container

Grand total - 20 minutes of your time + COPY time

Got it!

Synology’s NFS implementation is a mess. If this was Linux-to-Linux, I’d consider NFS, but, Synology Linux? That’s not for me. FWIW, I’ve been using cifs with success, and high transport.

Thanks again!

Actually, their implementation is exactly per specification.

I have a DS1815+, I have a Ubuntu 20.04 NAS DIY server, the NFS mount is the exact same .

mount IP-or-host:/path/to/directory /local-path

If you want speed, add the async option (they have sync, per spec, as default)
There is one limitation, RSIZE and WSIZE max at 131072. This is the old spec.

Regardless of these limits, I can still saturate 1 Gbps coming from the NAS.
When I setup LACP, it will deliver 3 Gbps (on 4 links) sustained .

If you want CIFS and are comfortable with it – that’s , of course, your call.

Re the sequence above, it will work with CIFS .

Mirroring the Plex environment (which is Linux) inside the container works.
I do it very often here with my testing when developing the packaging.
I have several LXCs and they are wonderful to work with.

Well… I think I’m there… but potentially have some mapping on reboot issues as the docker mappings may be getting ahead of the drive mappings from my NAS, which then cannot complete.

But otherwise things are good.

I did notice though that all my shows are being rescanned for intros… So maybe that data does not reside locally… but most metadata (except for a few posters), and viewing history seems to be good.

Thanks for your help!

@uvc6

If you show me your docker run spec , I’ll help you through it

Docker should start AFTER DSM mounts up the volumes.
Would you clarify the mapping timing issue?

I use docker-compose…

version: "2.1"
services:
  plex:
    image: lscr.io/linuxserver/plex:latest
    container_name: plex
    network_mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - VERSION=docker
    devices:
      - /dev/dri:/dev/dri
    volumes:
      - /home/uvc6/docker/plex/config:/config
      - /media/nas_media:/media:ro
      - /media/nas_music:/music:ro
      - /media/plex_optimized:/transcode
    restart: unless-stopped

What I see is that /media/nas_media is not mounting my NAS volume1/media shared folder, but instead /media/nas_media displays empty folders “tv shows” and “downloads” which appear to be created from my sonarr container, which has the following volume mappings…

      - /media/nas_media/tv shows:/tv
      - /media/nas_media/downloads:/downloads

Thanks for any suggestions.

Thanks for sharing that.

  1. Before shutting down PMS on DSM 7
  • Turn off ALL automatic library functions .
  • Turn off Empty Trash (Important)
  1. On DSM 7, the structure is different than Docker .
Docker:    /config/Library/Application Support/Plex Media Server
DSM7:      /PlexMediaServer/AppData/Plex Media Server
  • You need to create physical directories:
mkdir -p "/home/uvc5/docker/plex/config/Library/Application Support"
  • Put Plex Media Server under Application Support`
 sudo chown -R 1000:1000 /home/uvc6/docker/plex/config
  1. DSM 7 does not show you the physical directory structure but PMS sees it.

Change to this; (see it now?)

      - /media/nas_media/tv shows:/volume1/tv
      - /media/nas_media/downloads:/volume1/downloads

A-ha. That pesky “volume1” … I’ll give this a shot. I was hoping only to map “media” under which both “tv shows”, “movies”, and “downloads” all exist… And then point to the specfic “tv shows” folder in the Plex library mapping. FWIW, I’m coming from DSM6.

Live and learn. Thank you Chuck.

I’m still having issues with docker containers starting before the NAS shares are mounted> When this happens docker creates the necessary folders at the mount location, and the fstab mount then fails.

Somehow I must delay docker until the NAS shares are mounted.

FWIW, I tried NFS mounts and the same happened.For now, I will drop the “restart always” on affected containers.

Appreciate any advice

Which OS (Distro and version please) ?

You tag synology but on Synology, the entire RAID volume is mounted before any apps are started because the @appstore is on /volume1

I moved Plex to Debian (Buster headless) in a docker container. The NAS shared folder “media” looks like this…

media
| - tv
| - movies

Initially, using fstab, I mapped /volume1/media/ (Syno) to /media/nas_media (Debian)

The Plex libraries (tv, for example), then mapped to /media/nas_media/tv using Library settings.

I also run a sonarr container on Debian… with a volume mount like

volume:
    - media/nas_media/tv:tv

Everyone is happy until I reboot. Apparently docker runs before the mount “handshake” between Debian and Synology is complete. Two problems surface.

  1. Because sonarr is expecting /media/nas_media/tv, it adds the folder tv to /media/nas_media… which prevents the mapping to occur between Debian and Synology, as the directory /media/nas_media is no longer empty. Hence Plex sees no tv content.

  2. If I instead, prevent sonarr from restarting at reboot, The Plex docker starts, and sees only an unmounted /media/nas_media folder, and fails, before the mount “handshake” completes.

I searched quite a bit and found a post (which I’ve mispladed, lol) referring me to “autofs”. And another somewhat related link.

Thanks!

GOOD NEWS!

TO ALL FOLLOWING HERE:

Docker PMS is no longer needed for Hardware HDR tone mapping

You can

  1. stop docker plex
  2. install PMS 1.29.1 ,
  3. Let the database update
  4. Return to using the native package

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.