Is there any way to get Plex to test whether a media folder is available before it does a scan?

I have a Plex server running on Windows which accesses a Linux file server via samba shares. The issue is that if the file server is offline and a media scan is triggered it removes the library content and then rescans and adds it when it returns. Given that my file server is over 60TB you can see this is a problem.

Ideally I would like Plex to check the availability of the media folder prior to the scan and abort it if it is unavailable.

First things, you could disable the option Automatically detect when items are added this may stop it removing items.

I too have a file server and on my Plex server I map the drives and tell Plex to access that way.

However, when my data server is offline or my NAS, plex does not remove my titles.

How are you telling Plex to look for the folders?

You can also un tick, Empty trash after every scan. So when it finds the media again after a scan, it shouldn’t have to get the data again and appear as recently added.

I can also just confirm that I have lost access to two network shared drives and had re enter my credentials and Plex did not remove the data.

Here are the server library scan options…

These are on…

  • Update my library automatically
  • Run a partial scan when changes are detected
  • Update my library periodically
  • Empty trash automatically after every scan
  • Allow media deletion

I didn’t really want to have to manually trigger media scans manually as some libraries such as TV are quite dynamic.

OK,

Mine are all on, other than allow media deletion, that is simply to delete content from the share itself as well as the Plex Media Server.

As I mentioned above, two of my mapped drives were offline (I can only assume for a week or so) but Plex has not removed, re scanned the media at all. I entered the credentials for that server. The only thing that should happen is when you go to play a file its says its unavailable if that server is offline.

How does Plex see your data? Have you mapped the drives? Or have you manually put \192.168.6.2\TV Shows ?

The samba shares are mapped to local drives via Windows drive mapping.

Same as me then. Plex should not be removing all the data.

Normally this issue is the opposite and Plex doesn’t remove items you have deleted.

Weird… I am watching it chew away on over 3000 movies adding them back in. I guess I could take a look at the Plex api and write a tool to trigger the scan manually at which point I can test for any condition I want rather than let Plex do it automatically.

It is strange that our server are behaving differently though.

Did you turn off the setting Empty trash automatically after every scan as suggested above? This is the setting that triggers the deletion of the items from the database if they are not found. With this off, they will simply show as unavailable if the share is offline.

The downside, is that if you remove items from the library you will have to Empty Trash manually, in my case I rarely remove anything so I keep this setting off.

Lets face it, the Plex team must be aware that users have separate data servers and Nas drives and if one was to go offline and then Plex removed everything it would be a pain in the ass, which is exactly what is happening to you now!

When you add new items, are they going to that server which appears offline on your Plex server? Are you downloading your items on your data server and adding items to a folder or a share? If Plex detects a change to a folder (adding a new items) it will scan the folder. So if data is missing or appearing offline then it may remove it.

The file server is also the download server so Plex only sees library changes through scheduled scans. I can turn off the empty trash option but will have to remember to empty it periodically as most of my TV downloads are watch and delete.

Maybe the better option is to trigger trash empty through the api and a cron job from Linux assuming that is available on the api.