Storing Metadata on SMB Network Share

Hello, All,

First post on the forums.

I’m trying to figure out how to store the Plex Library (metadata) folder on a network share. I am running the last version of Plex on a Debian 10.7 machine. The network share successfully mounts at bootup and I’m able to read and write data to it with no issues.

I followed these instructions, but it’s not working and I’m not sure how to find out where the issue lies: Moving PMS 'Library'

Anyone know of a log file or something that I can check to see if Plex is reading the override.conf file and throwing an error somewhere?

Any help is much appreciated!

P.S. I’ve been running the Plex metadata from a network share in a Windows PMS build for years without any problems.

systemctl will tell you if it’s reading the override.

systemctl status plexmediaserver

I don’t see any reference to the override file in the systemctl status report.

This is a completely vanilla install of Debian 10. The only thing I’ve setup on it besides Plex is cifs-utils for mounting the SMB share.

Any other ideas? This is what my override file looks like:

#Customize Plex’s config
[Service]
Environment=“PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/media/Ple Library/Library/Application Support”

STEP C

Done. Here’s the status output

plexmediaserver.service - Plex Media Server
Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2020-12-08 10:54:39 CST; 54min ago
Main PID: 780 (Plex Media Serv)
Tasks: 45 (limit: 988)
Memory: 92.4M
CGroup: /system.slice/plexmediaserver.service
├─780 /usr/lib/plexmediaserver/Plex Media Server
├─803 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-b509cc236/Framework.bundle/Contents/Resources/Versions/2/Python/bootstrap.py --server
└─855 /usr/lib/plexmediaserver/Plex Tuner Service /usr/lib/plexmediaserver/Resources/Tuner/Private /usr/lib/plexmediaserver/Resources/Tuner/Shared 1.21.0.3711-b509cc236
Dec 08 10:54:39 JMD-Deb-Plex systemd[1]: Starting Plex Media Server…
Dec 08 10:54:39 JMD-Deb-Plex systemd[1]: Started Plex Media Server.
Dec 08 11:49:08 JMD-Deb-Plex systemd[1]: plexmediaserver.service: Current command vanished from the unit file, execution of the command list won’t be resumed.

I’m guessing it would show the override file next to “Loaded:”?

it would show

[chuck@lizum ~.501]$ systemctl status plex
● plexmediaserver.service - Plex Media Server
     Loaded: loaded (/lib/systemd/system/plexmediaserver.service; disabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/plexmediaserver.service.d
             └─override.conf
     Active: inactive (dead)
[chuck@lizum ~.502]$ 

Warning: Do not use /media as it is a reserved directory with Gnome. Select a target directory not used by any system applications.

Love the P.S.

Still nothing. Even though I’m not using Gnome, I even tried changing the Library location to somewhere other than the /media folder, but that didn’t make a difference.

Could a permissions issue be causing the problem? Also, even if I don’t need to change permissions, do I still need the UMask=0002 line?

Even though I’m not using Gnome, I tried changing the Library location from out of the /media folder, but it didn’t seem to help. :’(

Folks,

Rather than try to put a square peg (SMB) into a round hole (where NFS is needed),
I’ve decided to write this out.

You need NFS because most Linux hosts & NAS systems do not offer the needed SMB services PLUS you’re on a Linux host where SMB support is marginal and non-native.

This post is the combination of two existing server-linux-tips which I’ve authored for tasks such as this.

  1. Your mileage will vary . This is not supported because we cannot guarantee the integrity of the NFS server.
  2. It will work beautifully , albeit it a bit slower -or-
  3. It will crash horribly and corrupt your data on the NFS server

So, it’s time to ride the wild software :wink:

This is not for the faint of heart.

  1. Server must support NFS v4 - prefferably NFS v4.2
  2. A share must be exported with R/W for the IP address of the PMS host where this runs from with no-squash
  3. Use of SMB on a Linux host, which uses POSIX file locking for database operations, will fail every time.

Here’s how it works. This is a working example. You are free to use it as-is.

A. Stop Plex

sudo systemctl stop plexmediaserver

B. Make a directory anywhere which isn’t a pre-existing directory (this means no use of /media regardless the state of Gnome)

sudo mkdir /PlexMetadata

C. Set the ownership to plex and set permissions

sudo chown plex:plex /PlexMetadata
sudo chmod 755 /PlexMetadata

D. Create the /etc/systemd/system/plexmediaserver.service.d/override.conf

sudo sytemctl edit plexmediaserver

  • In this file place:
#  Move Plex's metadata storage to the NAS
[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/PlexMetadata/LibraryApplication Support"
  • Save and exit the text editor

E. Create and test the NFS mount entries for /etc/fstab

  • In /etc/fstab, editing as appropriate:

ip.addr.of.server:/metdata-share-name /PlexMetadata nfs defaults,vers=4,rw,auto,sec=sys,nofail,bg 0 0

(( The above is ONE line))

F. Test the mount

sudo mount /PlexMetadata
mount | grep PlexMetadata

(if errors, or if vers=4 is not shown, iterate here until working and can write to the NFS share (suggest ‘touch’ command) )

G. Transfer existing Plex metadata to network share

cd /var/lib/plexmediaserver
sudo bash
tar cf - ./Library | (cd /PlexMetadata ; tar xf - )

(If errors, correct the Network share export and/or the mount. Repeat process until tar completes without errors)

H. Verify final path exists as it should:

ls -la “/PlexMetadata/Library/Application Support/Plex Media Server/Preferences.xml”

( If the above lists as owned by plex:plex then you are ready. )

I. Update systemctl

sudo systemctl daemon-reload

J. Restart Plex

sudo systemctl start plexmediaserver

K. At some stable point – Restart the host and verify full restart.

Keep the existing contents of /var/lib/plexmediaserver until 100% positive this is working for you.

Thanks, @ChuckPa. I’ll give an NFS share a try.

I was hoping there would be a log file somewhere that might give me indication that it was trying to read the override.conf file at all. I’ll give the NFS share a try, and I suppose if it works, then that will be good indication that it was the fact that it was pointing to an SMB share was the problem.

There is no log file.

The only indication it is applied is by systemctl itself.

That’s fortunately how it’s done

I tried using an NFS share and it still does not load the override.conf file. I also tried pointing the metadata location to just a different local folder on the boot drive to bypass anything to do with a network share and still no luck.
It seems like it’s not even trying to load the override.conf file. Could this be the result of a permissions issue? There are only two users on the server, plex and root.

Show me the override.conf file please.

#
# Customize Plex's config
[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/home/plexdata/Library/Application Support"
# This is needed to change the default umask
UMask=0002

That is the last one I tried to test without moving the metadata to a network share. Just a plain folder locally on the boot drive. I also tested without the UMask=0002 entry. I wasn’t sure if the UMask=0002 entry was only needed if you needed to change the permissions or not.

Changing UMask is only needed if Plex is writing DVR recordings directly into your media folders.

By setting default permissions of 664, you can then set Plex as the owner and use your username as the group (splits the ownership) and you have the ability to delete them external to Plex if you so choose.

In case anyone else comes across this post looking for an answer, here’s what my conclusion was:
The reason Plex wasn’t reading my override.conf file was because I never made an override.conf file. I made a plexmediaserver.service.d file. Oops.
Secondly, I could not get the metadata to work at all on an SMB share (which isn’t supported, anyways), and it never worked for me stable-y on an NFS share (which also isn’t supported).

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