PlexData share for QNAP systems

Hey @ChuckPa and @dane22 thank you very much. Its sorted, and working.

New LAN setup on modem, and on ASUS router, removed PlexData, created it again, and BINGO!

Thanks guys :slight_smile: keep up with the good work!

1 Like

I just got a TS-251D and installed the latest plex server tonight. The PlexData share was created but not working. I could not edit properties on it. I removed the share and recreated it and now it is working.

Which specific PMS did you load please?

I did update PMS, and have a developer build 3110 which works.

PlexMediaServer-1.20.0.3133-fede5bdc7-x86_64

Let me check it. I didn’t know they rebuilt.

EDIT:

That’s correct.

I don’t know why you would be having difficulty.

Do you use normal CACHEDEV volumes or MDx volumes (pools) ?

Which version of the QTS firmware are you using?

QTS 4.4.3.1354 is the version installed on my TS-251D. I have it set up in Raid 1 with a storage pool. In that storage pool I have 2 thin volumes. 1 is for my regular files and the other 1 is for my Plex media files.

I have created new volumes here and created as you’ve described. I cannot reproduce your findings.

I would like to ask you to manually DELETE the Plex Data share (there is no harm)
Next, I would like you to create it again fresh, assigning properties as you deem appropriate.

PMS will find the share when it starts and use it.

build 3110 worked for me on QNAP TS-431P.

steps I took.

  1. I deleted PlexData
  2. installed build 3110
  3. changed permissions

Thank you for your dedication to the NAS users!

@ChuckPa - I have a TS 431P2.

Now running QTS 4.4.3.1381 and Plex 1.19.5.3112 and have the same error on restart.

Thanks for your positive comments :wink:
Apologies for slow response. I see lots of comments and responses have been added since mine.

Is there anything you need me to do?

@MattGroves

Since first mentioned by you (which QNAP still has not confirmed),
I have adjusted the package to NOT fail if the gpuhal_app is not present or not found.

1.20.3112 (latest package) has that correction included.

I do have one question: Did you edit the default system PATH ?

I’m running QTS 4.4.3.1381 and Plex 1.20.3112 and have the same error on restart.

I manually created the Plexdata share, but the error remains. I can see from timestamps that Plex seems to be bale to access the folder.

I did not edit the default system PATH.

@max_horvath

Which error please? There are a few floating in this thread now. :slight_smile:

How this works:

  1. Underneath, PMS, which runs as “root” doesn’t need permission to create the linkage.
  2. PMS runs independent of this share. This “PlexData” share is the equivalent of the old “PMSLibShare” in functionality with the added ability to follow where PMS is installed as it’s “migrated” to new volumes.
  3. PMS running normally or not is independent of this share. I made certain the startup scripts do not fail should there be any issues.

Well, it seems Plex would work, but everytime Plex Server starts it logs the error to the QNAP logs / notification center that PlexData share could not be created.

So I assume something is still not working as intended, because why else would that error be logged?

Max, I agree something isn’t right.

here is the code in question:

    # Verify PlexData share exists. Create if not.
    PlexDataDir=""
    [ -e /share/PlexData ] && PlexDataDir="/share/$(readlink /share/PlexData)"

    # Add if not found
    if [ "$PlexDataDir" = "" ]; then

      # It does not,  Create it
      PlexPkgVolume="$(echo ${QPKG_DIR} | cut -d/ -f 1-3)"
      PlexDataDir="$PlexPkgVolume/PlexData"

      addshare "PlexData" "$PlexDataDir"

      # Creation error? (should not happen)
      if [ $? -ne 0 ]; then

        logMsg="WARNING:  Could not create PlexData share.  Further assistance is available in our Support Forums. Continuing without."
        echo $logMsg ; /sbin/log_tool -t 2 -a "$logMsg"

        # We can't use this location
        PlexData=""
      fi
    fi
  1. If /share/PlexData doesn’t exist – we know we need create it.
  2. If it does, see where it points because we need that
  3. If, for some reason , it doesn’t resolve, it creates a fresh one

this is where you’re seeing it.

My machine:

  1. /share/PlexData exists
  2. reading the link to find its location
[~] # readlink /share/PlexData
CACHEDEV3_DATA/PlexData
[~] # 

since that exists (not a null string), I use it.

If null, I use $PlexPkgVolume/PlexData as the location where I want to create and point the share at.

If it’s failing, it must be failing here but how does it fail to get its installation path ?

# Location of QPKG conf file.
CONF=/etc/config/qpkg.conf

# Name of Plex Media Server install directory.
QPKG_NAME="PlexMediaServer"

# Grab Plex Media Server install directory, regardless of disk layout.
QPKG_DIR=$(getcfg -f $CONF $QPKG_NAME Install_path)

Thoughts?

@ChuckPa

I was getting the same error as @max_horvath, every time my NAS rebooted, ever since a Plex server update a couple of weeks ago.

If I change the following lines in the current production version of plex.sh (ver 1.19.5.3112-b23ab3896, July 20, 2020, ARMv7 TS-x31+, TS-X31P, TS-x31P2, TS-x31X, and TS-x31XV Series):

    # Verify PlexData share exists. Quick recreate if not.
    PlexDataDir="$(find /share -maxdepth 1 -print | sort | grep '/PlexData$' | head -1)"

…to this:

    # Verify PlexData share exists. Quick recreate if not.
    PlexDataDir=""
    [ -e /share/PlexData ] && PlexDataDir="/share/$(readlink /share/PlexData)"

…then the error stops happening. I’m no expert, but I think it’s because the shell version on my NAS doesn’t support the -maxdepth option for find. The find command fails, the if clause is entered when it shouldn’t be, and the error is thrown because it can’t create a share that already exists.

@jnjhmc

I switched to the [ -e ] (exists) test to remove ambiguities in determining if we have a “PlexData” share or not. I am glad it’s stopped the error from happening. That was the reason for the change. (I will check with QNAP but every QTS system should have the -maxdepth option in find. (It’s part of the distributed source code for find.)

It has been my understanding that all shares, including the MDx and CACHEDEVx volumes are all accessible via /share

To All here:

I am willing to, and will, do whatever it takes to make this work optimally for everyone whether there is one volume or multiple and independent of where PMS is installed on.

I would like to ask (because I don’t have another NAS here to try with),

Does anyone have a QNAP which has MD0_DATA or MD1_DATA as their main storage volume where QTS is installed?

I’m asking this because I am considering:

  1. Rather than creating the PlexData share on the volume that PMS is (which adds complexity)
  2. Create the shared folder & directory on the system volume (like other services are).
    This would be your DataVol1 volume.
  3. It would make it more predictable.
  4. It would eliminate the possibility of multiple “PlexData” directories in the system (one on each volume but only one active at a time) if Plex were uninstalled and reinstalled (a rarity but possible)

I also can, and will, create more packages for us to test with and share those here (they will be unsigned – of course).

Nope, not on mine:

Capture

The current publicly accessible production version at https://www.plex.tv/media-server-downloads/ still has the line with find ... -maxdepth in it. Do you have an idea when the revised/beta version with [ -e ] will be elevated to production?

I reworked the logic again for this.

  1. I query QTS about which volume (path) it is installed on.
  2. If I cannot pull the information about where QTS is installed (HDA, MD0, CACHEDEV1) then I abort installation. If this fails, then QTS is damaged.
  3. I then create the PlexData share on that volume, directory name PlexData.
  4. The linkage to where Plex actually is continues to function as before .

If any errors are encountered, they are raised as INFO.

If, for whatever reason, the PlexData share doesn’t get created, creating it manually will resolve the problem. I have already dispatched an email to QNAP requesting their assistance. They have not yet responded.

To try this, I ask:

  1. Stop PMS
  2. Remove the PlexData share and delete the ISO directory (check the box).
  3. Install PMS
  4. Go to Control Panel - Shared Folders - Assign the permissions you wish to grant.

It should now continue to function as it I intend.

I apologize for the difficulties here. I wish I had the additional QNAP models I needed during development to flush this all out up front.

Further, I would never have imagined QNAP to be so problematic.

Please let me know how this goes:

I had a problem building the Armv7hf_neon. I will address that with my team on Monday.

I was having problems with “Vol1” not showing up and being able to access permissions… I stopped PMS, deleted PlexData.
Under Shared Folders, Create… Create Shared Folder… named it again, then I “Enter Path manually” and found plex media server dir.
I believe it worked. PlexData now has 19.93 gigs in dir… Is that bloated?
I did not need to mess with advanced setting.

plexdata
@ChuckPa, From screen shot does the dir look correct? I have crash reports from 2017 ish. PlexData dir looks bloated. are there tips to clean up PMS( been on QNAP for about 5 years)?

Another question… I have a mirror image copy of my movie’s, etc… that a friend has for archival, how do I transfer an exact copy of PMS( metafiles and such) now that PlexData is available… Just copy PlexData dir over to his Mac PMS?

Lastly how does one figure out (make sense of) where a particular metafile is in the string dir’s or bundle dir’s of Metadata… OR how does PMS sort them… next to impossible to located metadata manually.

@ChuckPa… Great work on PlexData for QNAP… been scratching my head on how to! Seems like I got right?

It should look like this.

To undo any configuration errors the previous has done.

  1. Stop PMS
  2. Delete the “PlexData” share and check the “Delete ISO” box. to clear the directory.
  3. Now, when you install the new package on top of the existing,
    a. The same executable PMS software is put in that you already have
    b. I create the PlexData share on the “Default System Volume” (whatever that is).
  4. You still go to Control Panel - Shared Folders and grant permission for FileStation access and network access (it will be invisible to everyone until you do so - even admin because of how QNAP works)

I advise against manually creating the share because, if the package were ever to move (“migrate to”, or QNAP changed things), the share definition would be invalid.

If I’m understanding you right, you’ve done is right but is the keeps part of PMSLibShare. You’ve created a share which points directly at the destination. I create a shared folder on the default system volume and, in it, create a link to Plex Media Server which is really in the .qpkg/PlexMediaServer/Library directory.

This was created to supersede PMSLibShare by supporting Volume migration automatically.

If you’re fluent in Bash, here’s how I do it now.

  # Verify PlexData share exists. Create if not.
  PlexDataDir=""
  [ -e /share/PlexData ] && PlexDataDir="/share/$(readlink /share/PlexData)"

  # Add if not found
  if [ "$PlexDataDir" = "" ]; then

    # It does not,  Create it
    PlexPkgVolume="$(getcfg SHARE_DEF defVolMP -f /etc/config/def_share.info)"
    if [ "$PlexPkgVolume" = "" ]; then
      logMsg="QTS ERROR: Could not retrieve system default share from /etc/config/def_share.info. PMS cannot be installed."
      echo $logMsg ; /sbin/log_tool -t 2 -a "$logMsg"
      exit 1
    fi

    PlexDataDir="$PlexPkgVolume/PlexData"

    addshare "PlexData" "$PlexDataDir"

    # Creation error? (should not happen)
    if [ $? -ne 0 ]; then

      logMsg="Info:  Could not create PlexData share.  Please create manually and restart PMS."
      echo $logMsg ; /sbin/log_tool -t 1 -a "$logMsg"

      # We can't use this location
      PlexData=""
    else

        logMsg="Info: PlexData share created at '$PlexDataDir'."
        echo $logMsg ; /sbin/log_tool -t 1 -a "$logMsg"
    fi
  fi

  # If PlexData still valid, use and update link for File Station.
  if [ "$PlexDataDir" != "" ]; then
    rm -f "$PlexDataDir/Plex Media Server"
    ln -s "${QPKG_DIR}/Library/Plex Media Server" "$PlexDataDir/Plex Media Server"
  fi