Best mount settings for streaming ( Plex )

For those that use Sonarr, I took a stab at Sonarr a post-processing script that will generate a list of paths that need scanning:

#!/bin/bash

seasonrelativepath=${sonarr_episodefile_relativepath%/*}
seasonfullpath="$sonarr_series_path/$seasonrelativepath"

echo "$seasonfullpath" >>/home/plex/temp/makelist/plex.list
sort -u /home/plex/temp/makelist/plex.list -o /home/plex/temp/makelist/plex.list

exit

It generates a list in the following format:

/home/plex/amazon/Media/Television/Animals/Season 02
/home/plex/amazon/Media/Television/Attack on Titan/Season 02
/home/plex/amazon/Media/Television/Chopped/Season 33
/home/plex/amazon/Media/Television/VICE/Season 05

For now Iā€™m calling partial Plex library scans manually on my second machine from the command line via the following commands but it should be easy enough to send the list file over and automate the process:

export LD_LIBRARY_PATH=/usr/lib/plexmediaserver

/usr/lib/plexmediaserver/Plex\ Media\ Scanner -v --list
## find the number corresponding to your tv shows library

/usr/lib/plexmediaserver/Plex\ Media\ Scanner -v -s -r -c 3 -d "/home/plex/amazon/Media/Television/Animals/Season 02"
/usr/lib/plexmediaserver/Plex\ Media\ Scanner -v -s -r -c 3 -d "/home/plex/amazon/Media/Television/Attack on Titan/Season 02"
/usr/lib/plexmediaserver/Plex\ Media\ Scanner -v -s -r -c 3 -d "/home/plex/amazon/Media/Television/Chopped/Season 33"
/usr/lib/plexmediaserver/Plex\ Media\ Scanner -v -s -r -c 3 -d "/home/plex/amazon/Media/Television/VICE/Season 05"
## change 3 to whatever your tv show library number is above

Cheers to @Ajki, @enz1ey, and /r/gesis for their awesome scripts that helped me make sense of everything!

Edit: Hereā€™s a quick script I put together that takes the plex.list generated above and executes a partial library scan for each path in the list. Iā€™m sure it could be written better but Iā€™m learning as I go.

#!/bin/bash

if pidof -o %PPID -x "$0"; then
   exit 1
fi

export LD_LIBRARY_PATH=/usr/lib/plexmediaserver

logfile=/home/plex/scripts/logs/plexscan/plexscan.log
list=/home/plex/temp/makelist/plex.list ## set to location of your list
section=3 ## change the section number of your plex tv shows library

echo "$(date "+%d.%m.%Y %T") Scanning for new TV" |& tee -a $logfile

while read -r line;
do
  /usr/lib/plexmediaserver/Plex\ Media\ Scanner -v -s -r -c "$section" -d "${line}" |& tee -a $logfile
done < "$list"

echo -e "$(date "+%d.%m.%Y %T") Scan complete\n" |& tee -a $logfile

#echo "Deleting $list" |& tee -a $logfile
#rm "$list"
## uncomment above if you want to delete list after scan

exit

Edit2: If you have multiple lists you can combine them and remove duplicates via something like the following

sort -u /path/to/lists/*.list -o /path/to/output/combined.list

Edit3: Iā€™ve fully automated the process. Server1 downloads new content (Sonarr), makes a list of directories to scan (via Sonarr post-processing), and uploads the content as well as the list to GDrive (rclone cron). Server2 downloads the list (rclone cron) and uses it to run partial scans of only the directories with new content (plex scanner cron).

1 Like

What If I donā€™t use any automation tool and copy to the remote manually ?

Can you share a script that I can just set the path to have the manual scan ?

Btw thanks anyway

@Lol340 Have a read of these scripts. https://github.com/ajkis/scripts

@Lol340 Just make a text file with the paths you want to scan and rename it to plex.list - then run the above script. Donā€™t forget to set the location of your list and the section number of your tv shows library (mine is 3 but for you itā€™s probably something different).

How do I find my section number for my library?

Sorry Iā€™m a total noob with scripts

I posted the manual commands in my original post. Via terminal, first type this:

export LD_LIBRARY_PATH=/usr/lib/plexmediaserver

Then this:

/usr/lib/plexmediaserver/Plex\ Media\ Scanner -v --list

Then you can manually run scans via:

/usr/lib/plexmediaserver/Plex\ Media\ Scanner -v -s -r -c 3 -d "/home/plex/amazon/Media/Television/Animals/Season 02"

Replace 3 with the section you want scanned and the part in quotes with the directory you want scanned.

Thanks so much.

Btw, Iā€™m on ubuntu 16.04 if that matters.

1 Like

You run this command as plex or root / sudo user ?

@EliteAustria I run it as the plex user

1 Like

Iā€™v been following this topic some time now and the whole idea of rclone and having the data encrypted in the cloud for streaming is great.
The only thing what is somewhat a bottleneck is the (in most cases) very slow starts for streaming the content (10+ secs is usually no exception). This regards to ACDā€¦

Is the gsuites ā€˜googleā€™ drive option better in combination with rclone (encrypted).

Iā€™ve already tried the Hetzner SX131, which holds local stored data on common HDDs (encrypted) and loads very fast, but thatā€™s not to be comparedā€¦

It should also work well with a EX41S-SSD in combination with ACD or Gdrive right?

I use a 1245v2 with 32 gb ram and 2x 3 tb hdd and that works well for me. Costs me about 40 euro/month

Yes, that will workā€¦ Only not for 20+ TB :wink:

I have 30 tb currently

Yes, but not for 40 euro/month.

Of course not, 4.5 pounds/mo for ACD and 8 euro for GSuite added onto that for 1:1 backup. So 55ish euro for the dedi+cloud storage

Yes nice, but the thing is that streaming of local hddā€™s (server side) is always fast and works for the best
Iā€™ve experienced that with a SX131 with 60TB local storage (around 200 inc. TAX euro / month), but it runs a very flaky software raid controller. So not worth the money.
When it comes to ACD or GDrive for that matter you can store ā€˜plentyā€™ but streaming takes too much starting time. Thatā€™s more or less the whole ā€˜issueā€™ here.

I feel the tradeoff for price:performance is worth it easily. When I tried GDrive briefly the start times were similar to that of playing right off my Synology NAS. Will do real world testing in 1-2 weeks with rclone mount if everything goes as planned :slight_smile:

edit: tested 13500 kbps movie and it starts in 4.2s 35 mbps tv shows starts in 4-10s. Acceptable to me :slight_smile:

I believe Rclone isnā€™t yet updated with nodes caching for Gdrive.
A large Library will do lots of calls resulting in possible bans. Not sure on how far Rclone is being updated yet.

But what will be your setup?
Hardware (1245v2 with 32 gb ram and 2x 3 tb hdd) --> Plex --> Gdrive --> Rclone encrypted mount?

Yes but I will get around that by running sonarr and radarr against a local+acd and plex against local+gdrive. Based on what Iā€™ve read, partial library scans as well as disabling some of the maintenance Plex wants to do should allow me to stream off GDrive ban-free that way

Below works fineā€¦ still only the streaming starting time should improve.
SAB/Sonarr local +sync ACD/GDrive
Remote (hetzner.de) PMS+ACD/GDrive