Mirroring Plex-media-only-configuration to an additional new Plex instance

Hi everyone,

It’s a bit hard to explain, but I’m not trying to create an exact copy of a the whole Plex server (like all the existing guides have instructions for). I’m only trying to copy all Plex-media-configuration (so playlists, likes, what has been played, etc) into an additional new Plex server instance (so a Plex server instance with a different name, that can run simultaniously next to the other instance).

I’ve actually already succeeded in doing this, but I’d like to doublecheck here if I did it correctly and if my 2nd Plex instance can be considered “healthty”.

So here is a short description of what I’ve done / I’m trying to do:

Source (master) server

  • TrueNAS Core 13.0-U6.1 (FreeBSD) → Will be replaced with TrueNAS Scale soon
  • Plex Media Server 1.40.0.7998
  • Media mount point: /mnt/mediads/ → After installing TrueNAS Scale, this mountpoint will become /data and be the same on both source and destination
  • Plex Media Server instance name: Plex-Master

Destination (backup) server

  • TrueNAS Scale 23.10.1.3 (Linux)
  • Plex Media Server 1.40.2.8312
  • Media mount point: /data
  • Plex Media Server instance name: Plex-Backup

Actions taken

  • Install the Plex Media Server on the TrueNAS Scale destination server without any libraries, but completely working and available in Plex WebGUI interface.
  • Stop the Plex Media Server on the TrueNAS Scale destination server
  • Replace following folders on the TrueNAS Scale destination server with the contents of the TrueNAS Core source server:
    Plex Media Server/Media
    Plex Media Server/Metadata
    Plex Media Server/Plugin Support
    Plex Media Server/Plugins
  • Start the Plex Media Server on the TrueNAS Scale destination server
  • It seems to start ok, without errors and in the WebGUI all media-configuration seems correctly copied
  • Of course all libraries are still pointing to the incorrect path and when trying to change / fix this, I’m getting an error “Your changes could not be saved”
  • After finding "Your changes could not be saved" after changing library agent - #13 by QuestForTori I tried removing “Plex Media Server/Cache/cert-v2.p12” and haleluja, I am now able to change the library paths!
  • After rescanning all libraries, everything seems to work well and all media-configuration seems correctly copied to the destination server

The rescanning after changing the library paths of course takes a huge amount of time (and probably isn’t really necessary, as the media data should be in sync), but I hope that once I replace my TrueNAS Core master server with TrueNAS scale (and both servers having the same media mount point) this might not be necessarry anymore…

Also I noticed that there are no logs in “Plex Media Server/Logs”. Is this normal?

Question
So just to be clear (as I’ve already found a seemingly working solution to my problem), here is my question: I this a valid approach / process to follow? Or do you see any problems / issues with this?

Thanks!

Unfortunately I don’t know much about Truenas or Docker.
But I can tell you that you’ve done it correctly so far, if you have omitted the file Preferences.xml from the copy process.

In sync with what? Ultimately it is the storage location which ties a media file to its metadata. If you could make the Docker in such a way that the media files are accessible under the exact same folder/file names as they were on the old server, you can avoid both changing the library media paths as well as the costly rescans.

I’m not sure. Either it is being redirected to the global machine log, or you have an access permissions issue in your plex data folder.
(though I seem to remember that the former is non-default, and requires explicit instructions to do so)

1 Like

Thanks for the confirmation!

I have indeed not touched the Preferences.xml after the fresh /bare install on the destination server.

I have a replication task to sync my media on the source server with my media on the destination server (so the media files themselves should be the same on both servers).

I plan to reinstall the source server from TrueNAS Core to TrueNAS Scale very soon. After this the media files will be under the exact same folder for Plex, so that a rescan is (hopefully) not required anymore.

The only settings I could find related to logs were
afbeelding
and


But When I click on “Download Logs” nothing happens.
When I click on “Download Database” something does happen (under Activity it says “backing up DB”), but still nothing is actually downloaded :confused:

Regarding permissions, you could be right, because I did notice a couple of days ago that the “Logs” folder had a different owner vs all other folders in that location:

root@truenas-backup:/mnt/backup-pool/encrypted-ds/app-ds/plexconf-ds/Library/Application Support/Plex Me
total 307
drwxr-xr-x 7 plex media-r     7 Jul 28  2020 'Plug-in Support'
drwxr-xr-x 3 plex media-r     3 Jul 28  2020  Plug-ins
drwxr-xr-x 3 plex media-r     3 Jul 28  2020  Media
drwxr-xr-x 6 plex media-r     6 Sep 21  2020  Metadata
drwxr-xr-x 2 root root        2 Apr  1 12:24  Logs
drwxr-xr-x 2 plex media-r     2 Apr  1 12:24  Diagnostics
drwxr-xr-x 2 plex media-r     2 Apr  1 12:24  Drivers
drwxr-xr-x 3 plex media-r     4 Apr  1 12:24  Codecs
drwxr-xr-x 2 plex media-r     2 Apr  1 12:24  Plug-ins.orig
drwxr-xr-x 2 plex media-r     2 Apr  1 12:24  Updates
drwxr-xr-x 7 plex media-r     7 Apr  1 12:25 'Plug-in Support.orig'
drwxr-xr-x 3 plex media-r     3 Apr  1 12:26  Media.orig
drwxr-xr-x 4 plex media-r     4 Apr  1 12:26  Metadata.orig
-rw------- 1 plex media-r 12330 Apr  2 09:35 'Setup Plex.html'
-rw------- 1 plex media-r   727 Apr  2 09:35  Preferences.xml
drwxr-xr-x 6 plex media-r    15 Apr  2 20:38  Cache
-rw-r--r-- 1 plex media-r     3 Apr  2 21:41  plexmediaserver.pid
drwxr-xr-x 3 plex media-r     4 Apr  2 21:41 'Crash Reports'

However, even after fixing this and restarting Plex Server, there is still no log in the “Logs” folder

root@truenas-backup:/mnt/backup-pool/encrypted-ds/app-ds/plexconf-ds/Library/Application Support/Plex Media Server# ls -la
total 380
drwxr-xr-x 18 plex media-r    22 Apr  4 09:22  .
drwxr-xr-x  3 plex media-r     3 Apr  1 12:24  ..
-rw-------  1 plex media-r    42 Apr  4 09:22  .LocalAdminToken
drwxr-xr-x  6 plex media-r    16 Apr  4 09:22  Cache
drwxr-xr-x  4 plex media-r     5 Apr  3 08:34  Codecs
drwxr-xr-x  3 plex media-r     4 Apr  4 09:21 'Crash Reports'
drwxr-xr-x  2 plex media-r     2 Apr  1 12:24  Diagnostics
drwxr-xr-x  2 plex media-r     2 Apr  1 12:24  Drivers
drwxr-xr-x  2 plex media-r     2 Apr  1 12:24  Logs
drwxr-xr-x  3 plex media-r     3 Jul 28  2020  Media
drwxr-xr-x  3 plex media-r     3 Apr  1 12:26  Media.orig
drwxr-xr-x  6 plex media-r     6 Sep 21  2020  Metadata
drwxr-xr-x  4 plex media-r     4 Apr  1 12:26  Metadata.orig
drwxr-xr-x  7 plex media-r     7 Jul 28  2020 'Plug-in Support'
drwxr-xr-x  7 plex media-r     7 Apr  1 12:25 'Plug-in Support.orig'
drwxr-xr-x  3 plex media-r     3 Jul 28  2020  Plug-ins
drwxr-xr-x  2 plex media-r     2 Apr  1 12:24  Plug-ins.orig
-rw-------  1 plex media-r   727 Apr  4 09:22  Preferences.xml
drwxr-xr-x  3 plex media-r     3 Apr  3 08:26  Scanners
-rw-------  1 plex media-r 12330 Apr  4 09:22 'Setup Plex.html'
drwxr-xr-x  2 plex media-r     2 Apr  1 12:24  Updates
-rw-r--r--  1 plex media-r     3 Apr  4 09:21  plexmediaserver.pid
root@truenas-backup:/mnt/backup-pool/encrypted-ds/app-ds/plexconf-ds/Library/Application Support/Plex Media Server# ls -la Logs/
total 53
drwxr-xr-x  2 plex media-r  2 Apr  1 12:24 .
drwxr-xr-x 18 plex media-r 22 Apr  4 09:22 ..
root@truenas-backup:/mnt/backup-pool/encrypted-ds/app-ds/plexconf-ds/Library/Application Support/Plex Media Server#

Solving these issues will require the assistance of someone with direct experience of TrueNAS and/or Docker.
I can only give you this: Linux Tips

1 Like

Aha!

After a bit more searching, I found the logs in the docker container itself:

root@plex-test-75bc8cc4-bfrcc:/# cd ~plex/Library/Application\ Support/Plex\ Media\ Server/
root@plex-test-75bc8cc4-bfrcc:~/Library/Application Support/Plex Media Server# ls -la Logs/
total 331
drwxrwsrwx  3 root plex       8 Apr  4 14:33  .
drwxr-xr-x 18 plex plex      22 Apr  4 13:25  ..
drwxr-sr-x  2 plex plex       4 Apr  4 09:22 'PMS Plugin Logs'
-rw-r--r--  1 plex plex     554 Apr  4 09:21 'Plex Crash Uploader.log'
-rw-r--r--  1 plex plex 1135654 Apr  4 15:09 'Plex Media Server.log'
-rw-r--r--  1 plex plex    5370 Apr  4 13:13 'Plex Transcoder Statistics.1.log'
-rw-r--r--  1 plex plex  208382 Apr  4 14:33 'Plex Transcoder Statistics.log'
-rw-r--r--  1 plex plex    1856 Apr  4 09:22 'Plex Tuner Service.log'

So apparently, my assumption that the Plex Configuration Dataset that I’ve created on the host, is directly mounted in the docker container, is false. It seems like the configuration is somehow duplicated from the docker container to the Plex Configuration Dataset on the host. And the logs are somehow not properly duplicated to there (or maybe this is intentional?).
Anyway, this is sufficient for me, as long as I know where to find them…

I’ll try to have a look inside the logs now, to see if there is anything unhealthy / suspicious. But if I understand you correctly, what I’ve done so far should be “ok”, right…?

As I understand it, this can be defined in the Docker container configuration. You can map any folder in the container to a folder on the host machine if you want to.

If you have tested and found it working

  • adding new items and fetching metadata for them
  • editing metadata of existing items
  • playback with transcoding. Be sure to test both video transcoding, as well as audio transcoding from Dolby (AC3, E-AC3, TrueHD) codecs.

then it should be OK.

1 Like

I’m only just starting with Kubernetes / docker, so I don’t know much of it either I’m afraid. But here is what I could extract as Docker container config:

root@truenas-backup:/mnt/backup-pool/encrypted-ds/app-ds/plexconf-ds/Library/Application Support/Plex Media Server# k3s kubectl -n ix-plex-test describe deploy plex-test
Name:               plex-test
Namespace:          ix-plex-test
CreationTimestamp:  Mon, 01 Apr 2024 12:24:07 +0200
Labels:             app=plex-2.0.3
                    app.kubernetes.io/instance=plex-test
                    app.kubernetes.io/managed-by=Helm
                    app.kubernetes.io/name=plex
                    app.kubernetes.io/version=1.40.1.8227
                    helm-revision=8
                    helm.sh/chart=plex-2.0.3
                    release=plex-test
Annotations:        deployment.kubernetes.io/revision: 8
                    meta.helm.sh/release-name: plex-test
                    meta.helm.sh/release-namespace: ix-plex-test
Selector:           app.kubernetes.io/instance=plex-test,app.kubernetes.io/name=plex,pod.name=plex
Replicas:           1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType:       Recreate
MinReadySeconds:    0
Pod Template:
  Labels:           app=plex-2.0.3
                    app.kubernetes.io/instance=plex-test
                    app.kubernetes.io/managed-by=Helm
                    app.kubernetes.io/name=plex
                    app.kubernetes.io/version=1.40.1.8227
                    helm-revision=8
                    helm.sh/chart=plex-2.0.3
                    pod.name=plex
                    release=plex-test
  Annotations:      rollme: sA67K
  Service Account:  default
  Containers:
   plex-test:
    Image:       plexinc/pms-docker:plexpass
    Ports:       32469/TCP, 1900/UDP, 32410/UDP, 32412/UDP, 32413/UDP, 32414/UDP, 32400/TCP
    Host Ports:  0/TCP, 0/UDP, 0/UDP, 0/UDP, 0/UDP, 0/UDP, 0/TCP
    Limits:
      cpu:     4
      memory:  16Gi
    Requests:
      cpu:      10m
      memory:   50Mi
    Liveness:   tcp-socket :32400 delay=10s timeout=5s period=10s #success=1 #failure=5
    Readiness:  tcp-socket :32400 delay=10s timeout=5s period=10s #success=2 #failure=5
    Startup:    tcp-socket :32400 delay=10s timeout=2s period=5s #success=1 #failure=60
    Environment:
      TZ:                          Europe/Brussels
      UMASK:                       002
      UMASK_SET:                   002
      NVIDIA_DRIVER_CAPABILITIES:  all
      PUID:                        4009
      USER_ID:                     4009
      UID:                         4009
      PGID:                        5002
      GROUP_ID:                    5002
      GID:                         5002
      PLEX_CLAIM:                  claim-<censored>
      PLEX_GID:                    5002
      PLEX_UID:                    4009
    Mounts:
      /config from config (rw)
      /config/Library/Application Support/Plex Media Server/Logs from logs (rw)
      /data from data (rw)
      /shared from shared (rw)
      /tmp from tmp (rw)
      /transcode from transcode (rw)
  Volumes:
   config:
    Type:          HostPath (bare host directory volume)
    Path:          /mnt/backup-pool/encrypted-ds/app-ds/plexconf-ds
    HostPathType:
   data:
    Type:          HostPath (bare host directory volume)
    Path:          /mnt/backup-pool/encrypted-ds/media-ds
    HostPathType:
   logs:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
   shared:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
   tmp:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
    SizeLimit:  <unset>
   transcode:
    Type:       EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:     Memory
    SizeLimit:  8Gi
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  <none>
NewReplicaSet:   plex-test-75bc8cc4 (1/1 replicas created)
Events:          <none>

If I understand this correctly

  • /mnt/backup-pool/encrypted-ds/app-ds/plexconf-ds (on the host) is mounted to /config (in the container)
  • /mnt/backup-pool/encrypted-ds/media-ds (on the host) is mounted to /data (in the container)
  • EmptyDir (on the host) is mounted to /config/Library/Application Support/Plex Media Server/Logs (in the container)

It seems to me like this (apparently default) configuration “excludes” the Logs folder from being available on the host.

Again, as long as I know how to find the logs and as long as this configuration isn’t “unhealthy” for Plex, I don’t really care that this is how it is done…

What does concern me a little bit, is that the “Download logs” and “Download database” button don’t work in the Plex WebGUI.
Also it seems like this docker configuration causes the logs to get lost everytime the docker container is restarted.

Thanks for this advice. I will try these things out later this week!

I’ve created following “TrueNAS Charts” bug report for the log filesystem issue:
https://ixsystems.atlassian.net/browse/TNCHARTS-914

And they have fixed it in version 2.0.4 (I did need to do a reinstall of the Plex app)

I’ve also retried to “Download Logs” and “Download Database” and it still doesn’t work. But after trying a bit more, it seems to be caused by my browser.
It doesn’t work on Vivaldi (even though it is configured not to block any cookies or tracking for this site) and it does work in Firefox. Not sure if that is a Plex bug though or if it is something still wrong with my Vivaldi browser settings… (Perhaps this is something you can easily try out yourself, if you’re interested in making sure everything properly works in the Vivaldi browser)

I still need to try out your tests to make sure my “plex-mirror” properly works… Will report back on that later…

A report back on what @OttoKerner suggested for testing the health of my mirrored plex:

  • adding new items and fetching metadata for them
    → works fine
  • editing metadata of existing items
    → works fine
  • playback with transcoding. Be sure to test both video transcoding, as well as audio transcoding from Dolby (AC3, E-AC3, TrueHD) codecs.
    → works fine for video, but I’m not sure how to properly test it for audio with those specific output formats that you mention.
    I was able to change the amount of channels (I tried 3.1) in the “settings - player”, but not choose something like AC3, …
    After this change, when playing video and choosing settings, “audio stream” still says the original output format (DTS-ES 6.1 in the my test video) and nothing about 3.1.

It was also an extreme struggle to make Plex Settings - “Remote Access” to be fully accessible outside your network (only an indirect connection worked).

After a very long search I found that I need to enter the following in Plex Settings - Network:
LAN Networks: 172.168.0.0/16,192.168.0.0/24
The first IP address is the subnet that kubernetes VMs lives on TrueNAS Scale (set in the TrueNAS Kubernetes advanced settings) and the 2nd subnet is subnet of my TrueNAS Server.

As a final check for the health of my Plex server, I also had a look at my log files if I could find any alarming errors or warnings and I did find some:

...
Apr 20, 2024 02:21:24.853 [140534868699960] ERROR - [Req#5a494] Error parsing allowedNetworks entry '192.168.0.024 ': Invalid argument [system:22]
Apr 20, 2024 02:21:24.856 [140534968810296] ERROR - Error parsing allowedNetworks entry '192.168.0.024 ': Invalid argument [system:22]
Apr 20, 2024 02:21:34.845 [140534968810296] ERROR - Error parsing allowedNetworks entry '192.168.0.024 ': Invalid argument [system:22]
Apr 20, 2024 02:21:34.848 [140534884866872] ERROR - [Req#5a4f9] Error parsing allowedNetworks entry '192.168.0.024 ': Invalid argument [system:22]
Apr 20, 2024 02:21:34.848 [140534884866872] ERROR - [Req#5a4f9] Error parsing allowedNetworks entry '192.168.0.024 ': Invalid argument [system:22]
Apr 20, 2024 02:21:34.851 [140534970919736] ERROR - Error parsing allowedNetworks entry '192.168.0.024 ': Invalid argument [system:22]
Apr 20, 2024 02:21:44.849 [140534868699960] ERROR - [Req#5a542] Error parsing allowedNetworks entry '192.168.0.024 ': Invalid argument [system:22]
Apr 20, 2024 02:21:44.849 [140534868699960] ERROR - [Req#5a542] Error parsing allowedNetworks entry '192.168.0.024 ': Invalid argument [system:22]
Apr 20, 2024 02:21:44.852 [140534970919736] ERROR - Error parsing allowedNetworks entry '192.168.0.024 ': Invalid argument [system:22]

I also found the reason for these errors. It is seems like something that could be improved in Plex. The problem was that there was a space after my list of LAN Networks. It would be nice if Plex could either not allow spaces or could properly ignore them…

After fixing that, I no longer see alarming errors or warnings in my log files

1 Like

It is about the audio format of the source file. So test files which do have these audio codes in them, by playing them in a client which definitely doesn’t have Direct Play support for them. (Chances are good if you use a web browser and/or restrict the bitrate during playback.

Use the Activity - Now Playing in the dashboard of the web app to verify the “transcoding” status of the audio stream. If you then still can hear the audio, transcoding is apparently working.

1 Like

Do you mean like this?
image

image
This works too

DTS is not a Dolby codec, though.

1 Like

I’m not sure if these are Dolby either, but I’ve tried some more random media:
image
image
image
image

They all indeed are by Dolby.
So that is working fine, as well.

1 Like

Thanks!

I guess that all is working fine then…

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