Switched from regular debian install to docker and back... when I changed path to media and rescanned all files were deleted

Server Version#: Version 1.13.9.5456
Player Version#: Not Applicable

Title says it all. Had PlexMediaServer up and running fine on Debian Stretch. Decided to try Docker image as I use docker for many other services. I was having odd permissions issues from time to time… It would work, I would restart the container, and it would give me errors about not being able to find files or folders for my media. Stopped the container, deleted it. restarted the PlexMediaServer service. I went to change the library paths from their docker configuration. For example:

Physical path is /plexvault/Library/Movies/ . While using Docker, I changed it to /data/Movies and mounted the volume from /plexvault/Library/Movies. Actually, I use a symlink in / named plex that points to /plexvault/Library .

After making that configuration change back to /plex/Movies/, I clicked Scan Library… everything showed up, but all had a red trashcan over the image… and quickly the icons disappeared. /plexvault/Library/Movies was then empty… completely empty.

I did this about an hour ago… what logs should I submit, and where? While almost everything in those folders is recoverable or already watched… this is very troubling. Until further notice, the plex user will not have write permissions to the my Library.

Oh, and I’ve made a couple of posts on others threads this morning, but I’m all ready sick and tired of the condescending “Plex would not delete files unless you clicked ok on a dialog box” or “I have never seen a verified report of Plex mass deleting libraries” replies to posts from others.

Sorry for your loss, there are some steps to follow before changing installations.

  1. Open Plex Web App.
  2. Go to Settings > Server > Library.
  3. Disable the Empty trash automatically after every scan option.
  4. Save Changes

Thanks for responding Tiebierius.

Ok, I see that this is checked, and is checked by default I assume as I don’t remember changing it.

What does leaving it checked entail, and how would this have resulted in not losing all my files? Nothing was marked as trash when I changed the “Add folders to your library” paths when editing my Library.

I’m sure I missed some best practices and took some shortcuts on my testing… but would like to help ensure this doesn’t happen to others. The steps I took resulted in deleting a could TB of files without any warning or confirmation prompts.

I switch back and forth between docker and regular install, learned to make sure the library path is the same on both.(plus a backup before hand).

When you started up the pkg install it scanned your library which it couldn’t reach. Marked all your media as removed, then you conveniently changed the library path for Plex which emptied the trash of all things removed.

Another thing I should have done (which would have avoided me from having to reconfigure the Library paths when switching back from Docker to “bare metal” would have been to make a copy of the /var/lib/plexmediaserver config directory and pointed my docker container to that. As it was, I used the same configs for both environments, and that wasn’t a good idea.

Also, thinking more on this… is that a good behavior for the application to take? If it can’t reach a library path for some reason it will mark it in the meta-data as “removed”? What about people who use external drives? If they have some hiccup on their USB drive, and plex can’t access it… when they fix their error, is plex really going to remove everything that is in that folder?

Turning off “Automatic Scan” and “Empty Trash” is the best (and documented) procedure when moving to another system (Docker qualifies as ‘another system’)

https://support.plex.tv/articles/201370363-move-an-install-to-another-system/

Thank you, as I said I’m sure I skipped / missed some things. It would be nice if Plex would track an error connecting to a library vs a user request to delete and treat them differently.

Also, for anyone else… with running pms on Debian, I was able to use a utility named testdisk to recover just about everything that was deleted. So far it’s recovered / restored 390 files. Possibly an option for others who are running on Linux systems… I was careful not to modify the contents of the disk hosting the library so as to not over-write any of the actual bits.

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