Corrupt DB?

Latest versions of server and player as of this post on 11/1/2021. I don’t think it’s version related though.

I had a 256GB SSD system drive. Between plex data, gdrive and backblaze caching the drive will periodically get filled up. I moved my backblaze cache to another drive. Been running great for a year. Starting bumping up against Drive space again so I decided to move my Plex data to another drive using this process:

All was uneventful other than the fact it took about two days to move the 1.5M files to a platter drive in my system. Rebooted the system as described and that drive just thrashed for about 2 days. I figure it’s refreshing data/confit etc. wasn’t sure but I figured it would stop eventually. It never really did.

I also noticed that no matter what player I’m on I am getting more failures than success when trying to play media and even loading the Home Screen was painfully slow and often didn’t completely load.

I also noticed that profiles confirms we’re jumbled together. I would watch under one family user and my wife could switch to her profile and see my “continue watching”.

Basically something is hosed.

Yesterday I installed a larger system SSD and migrated my plex data back to the system Drive. Took hours again but faster than the first migration.

There was some thrashing again but under my admin profile I could successfully watch things although it would sometimes take multiple tries. Again, I figured it was recompiling or something.

Still messed up.

So…….any thoughts? Is there a way to “reset” the database without losing my users? I have multiple family users with different sharing settings etc. I don’t want to destroy everything.

Help……:frowning:

Sounds like something wasn’t done properly. It shouldn’t have taken 2 days to move the data. If you moved the data properly and set the path, it should just work right away. If you have your logs from either of these moves I can look to see if I can figure out what it did. I wonder if you didn’t set the path properly so PMS couldn’t find it and ended up rebuilding all of it.

Your sharing info is not saved in the database, the watched status is, but which users have access to your server and what libraries is saved in your account info with Plex.tv. However, your library info is in the database and if you redid your libraries, they may change and that would affect their sharing ability. You would need to re-select the libraries they have access to.

1 Like

I get what you’re saying, but even after deleting the data in the prior location in both places it would work…ish. Just VERY poorly and unreliably. 1.5M writes of mostly small files on a 5400RPM platter disk takes a long time!

Nothing else changed with regard to Plex. Didn’t change anything with libraries or their locations. I stopped Plex server, stopped the update service as described, copied all the files and once it was “running” from the new location I deleted the old files. If I “set the path” incorrectly (I assume you mean the registry path addition for the DB) would it have loaded my libraries at all? What controls profile history and such? Why would user “continue watching” items be conflated between home user profiles?

Not sure what logs from these moves you are referring to. I just dragged/dropped the files in Windows Explorer. Where would these logs be? I’m sure RoboCopy or similar would have been faster from a command prompt, but this way I was able to use my “server” in the interim since it’s used for other things.

Thanks for helping!

If this drive went full while Plex was running, chances are that the primary Plex database file is already corrupted.

1 Like

I wouldn’t be surprised at all.

Just now I rebooted the server and my player on my laptop finds no libraries at all anymore now that I have moved it back to the original, system drive. I simply removed the key added here:

I looked at the registry key just now and that path string isn’t there, but still no libraries…:frowning:

Revert to one of the backups and hope they aren’t affected as well.

1 Like

I don’t know if it means they are affected also, but my libraries are gone. I tried to restore a backup from a couple weeks ago which was before I ever tried to move the DB the first time. Something odd though:

image

As per the restoration process:

Move the following files out of the directory and store them somewhere for backup, just in case. (You don’t want the “-shm” and “-wal” files to remain in the databases directory when restoring the corresponding database.)

com.plexapp.plugins.library.db
com.plexapp.plugins.library.db-shm
com.plexapp.plugins.library.db-wal

The db-shm and the db-wal files didn’t even exist when I opened this directory.

They only exist if the server was not shut down in an orderly fashion.

1 Like

Well, whatever the cause it appears I need to rebuild the DB. Is there a way of doing that, that will result in a perfectly fresh setup since I won’t lose my account and sharing info?

At minimum I know I will have to “remember” how all my libraries were set up.

If there is metadata in a folder already will it still re-download every file for example?

If I have to completely start over I want it to be pristine.

You won’t lose access to servers shared with you, since these are attached to your plex user account. You will keep your user account, of course.

You will however need to recreate any shares you gave to other Plex users (managed or regular) because you are going to re-create all libraries from scratch.
You will probably also need to reset the home screen and side bar in all your plex apps.

I recommend you to go out and buy a larger SSD. Then set up the server to use that as the location of the plex data folder right from the start.
If you have a desktop computer, but are out of .m2 slots, you can use a PCIe adapter to m2.

You only need to empty-out the whole plex data folder to make all old library data disappear.
(Or point Plex to an empty folder via the registry key)
Leave all the other registry data as they are!
Shut down the server using the tray icon, before doing that.

Before you are going to recreate your libraries, I recommend you to go to
Settings - Server - Library - ‘Show Adanced’
and either disable or at least set to only “as a scheduled task” all media analysis tasks, like intro detection, loudness and/or sonic analysis etc.

When recreating your libraries, go one by one. Give your server plenty of time to fetch all the metadata and perform its database maintenance tasks inbetween.
If you add all source folders of a library during the course of its creation, Plex will use each file’s date/time stamp as its “Added at” date.

1 Like

Understood on this and I wasn’t worried about that. I only access one other friend’s server and have used it maybe once in 5 years.

This is also not a HUGE deal. That is all in the background to the users and I only share with a few family members (most are home users, a couple external friends) and I already told them to ALWAYS be prepared for outages…this isn’t NetFlix…:wink:

Meh…

I have already gone from a 250GB to a 500GB in the last iteration of “how to blow up your Plex server in 3…2…1…”

I don’t have any M.2 drives. All mine are SATA. I have considered wiping out and putting the 250GB back in for the sole purpose of Plex caching though. Is that better than using the system drive with sufficient space?

Well…if I open Plex Player on my daily laptop it already shows nothing. Nada. I do see that one library shared with me if I change servers, but there is nothing in Plex at all. It’s as if those files have already been deleted. I guess it won’t hurt to ACTUALLY delete them. I have already backed up that directory anyway. The odd thing is that although I deleted the original registry key pointing to a non-default data directory, it’s acting as if it was still LOOKING for that now deleted directory based on the behavior here.

For kicks I cleaned out the original, default DB directory (which it should be pointing to now that I deleted the registry string telling it to look at the drive I originally moved this to) and added one library to see what happens. It’s not good. It created a NEW folder with all the requisite subfolders on the drive I’m no longer using for my DB.

GRRRR

I looked in regedit again and that redirect is certainly gone so how would Plex even know that drive exists in this context?

I’m going to delete this test library, reboot the server again to see what happens…

Something odd under the scheduled tasks advanced settings is that the directory for DB backups was still set to the now non-existent drive.

Ugh…

Clear out the input field to reset it to the default location.

I wonder: look for a file Preferences.xml in each of the different locations where you used to store the plex data folder. Delete the xml file.
Do so while plex server is shut down, ofc.

Going with a m2 drive (per PCIe adapter, if required) will free up one SATA connector. That’s a plus if you have a lot of media drives.

Plus, m2 will use the full PCIe speed instead of being limited to SATA speed.

Did you think of the “Plex Updater service”? It uses a separate registry branch.
See the “Addendum” part of the HowTo article.

Did that already when I saw it there.

The only preferences.xml file is in the root of the “Plex Media Server” folder. I opened it in notepad++ and searched for the drive letter of the drive I used for a few days. Nothing.

That’s a good thing, but all of my MEDIA drives are external, USB3 or better. The only internal drives I keep are the system drive and optical drives.

I saw that addendum, but it is in the same key:

I didn’t make any change there so I didn’t have to undo any change there in this regard. The only drive reference I ever saw in that key was the change I made to move the live data. The default key had zero drive references in any of the strong data. I deleted that created string value when I moved the data back. For some reason it recreated the “new” directory that I had not only moved the data back out of, but deleted the folder entirely.

I rebooted and Plex had recreated the DB folder structure in the temporary location on the drive I’m no longer using. I shut down Plex server, deleted that folder AGAIN and as as soon as I started Plex server back up, it recreated it all again immediately.

I looked at the reg key still no reference to any assigned paths. Still no reference to that drive in the preferences.xml file.

Ugh…

Are you using several Windows user accounts on that computer?
Running Plex server as a system service?
Or even using “Run as Admninistrator”? (don’t!)

I am not using multiple accounts on that computer. It is technically a windows 10 PC but I just use it as a server.

I am also not running it purposely as administrator.

Perhaps I’m interpreting it wrong, but it seems odd to me that if either of those things were the problem it would have happened when I initially moved the database as well.

You are right. I was just making sure.

So how can I start fresh and wipe out any possible settings for Plex Server? Will an uninstall/install do that?

Will I have to re-authorize every client that ever logs into my server like phones, tablets, TV, Rokus etc or is that stored in my account online as well?

BTW, thanks for all your help. I know the pay sucks…

https://support.plex.tv/articles/201941078-uninstall-plex-media-server/

Nope.

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