Server Version#: Version 1.20.3.3437
I have two NASes, one primary the other secondary (as in primary backing up onto the secondary with Plex scanning disabled). My rsync script has been copying over all the media AND Library folder daily excluding the Preference.xml file to have Plex running on the same database on both servers.
Last week I had two events happening on my NASes.
Both my plex installation lost the database settings out of the blue (no update or action what so ever from myself) giving me the message::
This library is currently empty
Expecting more? Visit the Manage Libraries page to add folders and scan library files.
The very next day for a totally unrelated problem my primary NAS filesystem got corrupted (XFS issue)
Now, As part of the disaster recovery I have restored all the data from the secondary NAS onto the primary, this included copying over the plexmediaserver content. I unfortunately happen to have overwritten the Preference.xml too on the primary which wasn’t very wise I suppose.
So current situation is:
Primary NAS:
data fully restored (including hundreds of thousands of Plex Library files)
Plex in unreachable (I guess the Preference.xml does’t have the correct MachineIdentifier any more
Secondary NAS:
plexmediaserver Library folder appears to be full of data but Plex reports:
This library is currently empty
Expecting more? Visit the Manage Libraries page to add folders and scan library files.
So my questions are:
how do I reverse engineer the correct MachineIdentifier and anything else I would need to have Plex running again on the primary server
Given on both NASes happen to have the Library fully populated how do I re-add it onto Plex without losing all (as in having to rescan from scratch and match manually all the mistakes/not-found titles)?
Ok let’s take a different approach. Where is the Library defined in the linux filesystem?
Looking for the place where plex reads when deciding where to scans for media
I’m sorry about the delay but for some reason the forum didn’t notify me.
First, the bad news: There is no way to reverse engineer the UUIDs.
Second, dependent on which way you installed Plex (plug-in or the debian base), we can probably bring things back by hand-crafting at the command line .
Given you have rsync in use, what can you tell me about the pathnames you’ve been syncing?
plex was installed via openmediavault plugin if I remember well. At the time I did create a symlink from /var/lib/plexmediaserver/ to /mnt/raid5/plexmediaserver/ so rsync has resolted the whole directory. About the full backup process you can check this thread which was very informative for me:
In the meantime I did a fresh install of plex on the primary server (nothing that could be lost any ways). I don’t mind re-adding the server as new but the main point is how to re-set the Library with all the folders I had without having Plex thinking they are new.
btw this worked for years and years so haven’t changed anything in this sense if it can help.
OMV as far as I can tell it’s not using docker for plex (yet) just old style plugin which comes with a web frontend (nothing special) and the actual plexmediaserver is sthe standard debian base. As a matter of fact I always update plex via apt-get
Finally the two servers are on two different VMs on different ESX servers on different sites
As far as PMS is concerned, it’s using the default location.
You rsync'd the `/mnt/raid5/plexmediaserver directory?
If so, we can pull it back, as a tar-ball (faster than rsync) and put it back into position as if a full backup , possibly switching to a backup of the DB, and having it refresh everything , without losing.
If you’d like, while restoring, we can migrate you to a systemd override file and avoid future dependency on the symbolic link or an overlaying bind mount.
no I think rsync on a file basis is way faster since my Library is abour 9GB
this is what I have done already (restored from backup server onto primary), however the Preference.xml was overwritten so I moved it and allowed Plex to create one. Can you please elaborate on the backup of the DB part?
I don’t have any issue keeping the symlink but please explain better this option as well
The main issue though (as per OP) the day before the system crashed both primary and backup lost the “database definition”, so it’s now asking me to specify where to find the media. With this in mind even restorinf the full Library I’m not expecting this to work out of the box.
I did (as a test) add one of the media folder having the Library restored already but it starts a brand new scan. Is it worth trying to specify where the media lives at config file level? If so what fil needs to be modified?
FYI only : cd source dir; tar cf - . | (cd dest dir ; tar xf -) is a read-send through the memory pipe-write it as it comes out. Because it’s two processes, it’s more async than rsync you have two independent i/o sets active (i’ve timed it for my Plex backups). That said, do what you are most comfortable with
The “backup” copy of the DB is very straight forward.
sudo bash
cd "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
ls -la
On the primary server (where I’m performing the actions you’re suggesting) I see neither the local nor the secondary plex server. I have tried logging on/off multiple times but it doesn’t seem to find it:
Ok I actually fixed the “unseen” server logging into my account via VPN. Regardless this is now fixed. I’m now looking into the database issue.
Re-reading one of your posts above:
Scan all files
Refresh all metadata for each section to recreate any missing bundles
Scanning is is exactly what I was trying to avoid as there’s a large amoutn of manual match I did in the past to the plex not matching automatically. Following this procedure is a new match performed (asking as this would be unwanted)?
To recap where I am now is:
Account has both servers associated
-After the db restore procedure described above onto the primary it seems like ti takes sometimes to start the process and actually it failes after few seconds:
Ok I think I progressed greately thanks to all the info you provided me!
I had to install the prev version as I guess there’s a dependency betwen database and plexmediaserver version. So I think this is what was making my plex process failing.
Followed the steps above (copied db, re-define the library, scan + update metadata) and eveyrthing (almost) seems to be in there now.
There are a couple af secondary issues that still bother me but I’m unsure if I can fix this (still very happy of where I am)
Here’s the issues:
1- I have lost all the “watched” information
2- It seems like the “Last Added” sorting refers to added in the database as I understand not on the filesystem so Last added is actually = Aphabetical right now. Wondering if Last added to the filesystem sorting is possib le or perhas this can be a featire request?
3 Some titles are not matched however if I do a manual match the very fist occurence is the correct one, not sure why this is happening. It seems like Plex has skipped them for whatever reason.
4 While refreshing the metadata I get these errors:
Following some reading in Internet I:
a. stopped plex
b. removed the content of: /Library/Application Support/Plex Media Server/Plug-in Support/Data
c. started plex
it seems like the content has been recreated automatically however (reduced) I still get some of these errors in the console.