Rebuilding Plex server on existing machine, am I doing it most efficiently?

Server Version#: 1.19.3.2764
Player Version#: Plex Web 4.30.2 (and other clients)
Running on Debian Stretch under OpenMediaVault (OMV)

Hi - Been running Plex for years but unfortunately suffered a corrupted hard drive which included the boot partition. Now Plex is installed to a clean drive and I’ve taken the default location for the Plex data /var/lib/plexmediaserver.

The old Plex data is on another drive and was not affected by the crash.

It’s not exactly the same scenario as ‘Move an Install to Another System’ but pretty close so I’m taking my cues from that article. I pointed Plex to my existing media and have let it run through its very long process of fetching metadata for each video. The idea is that once that’s complete I’ll then replace the Plex data with the old Plex data.

But actually does that make sense? If I’m going to replace the new Plex data at /var/lib/plexmediaserver with the old data, is there any need for Plex to first build up metadata new? Is it safe to immediately replace whatever is in /var/plex/mediaserver with my old data?

Seems to me it probably is.

I think I went into this with prior knowledge that only muddled my thinking.

Finally, when this is all complete, I plan on moving the Plex data to another drive, but that will be handled within OMV which will also handle the systemd stuff automagically.

Thanks!
Mark

This might be a bit more techy and maybe what you’re looking for?

Hi ChuckPa! Thanks, the way I read that it pretty much confirms that I’m wasting my time building up the metadata fresh for the new Plex install when I plan on replacing it with my ‘old’ data anyway.

Oh, one thing I should have mentioned: I’m using mergerfs with OMV. mergerfs makes all the media drives appear as one big drive; that’s what Plex sees. With each new install of OMV, the name of this drive changes. That means that the new install of Plex sees the media on a different drive than what is saved in the old Plex data.

The idea is to replace the contents of /var/lib/plexmediaserver with the existing data on the ‘old’ drive [think of that as the backup I guess] and start up Plex.

My belief is that Plex, when scanning the media at a new location in combination with the old Plex data, will match each video and update the new Plex data with the metadata from the old Plex data.

Make sense to you?

To get around the “Old Name” -> “New Name”, there’s a trick.

I don’t know if OMV allows this but:

  1. mount --bind /old/name /new/name
    -or (if desperate)
  2. ln -s /new/name /old/name

After it finds everything again,

  1. add the new location name(s) to the library sections. Do not delete the old yet
  2. let it scan again and declare all as duplicate (2 appears)
  3. when done, remove old location
  4. let it scan one last time to remove the dup flag
  5. Empty Trash
  6. Clean Bundles

Move to the next section.

1 Like

Hah-hah!! Yes, until recently I was using a similar trick. It works but I began to feel uncomfortable with knowledge easily forgotten and decided to abandon the approach and play it by the book. But thank you! It’s good to know you endorse such methods, makes me feel less uneasy.

Anyway, unless you correct me, I’m going to go ahead with my plan. Thanks again ChuckPa!

ChuckPa: I’ve got a problem. I thought I had correctly noted the old path to media, but apparently did not.

  1. Installed Plex, set server friendly name in Web client but installed no libraries.
  2. Shut down Plex
  3. renamed new plexmediaserver dir to plexmediaserver.barren
  4. Copied old plexmediaserver dir structure to plexmediaserver and set plex as owner and group for plexmediaserver and subdirs.
  5. Created a symbolic link between the new media location (/srv/e76ca4aa-eacc-44bd-a213-0fdb8ca9f852) to what I believed was the old media location (/srv/4136d90d-2d76-4434-890f-56c206fd3bf0): ln -s /srv/e76ca4aa-eacc-44bd-a213-0fdb8ca9f852 /srv/4136d90d-2d76-4434-890f-56c206fd3bf0
  6. Started Plex.
  7. Added a library pointing to /srv/4136d90d-2d76-4434-890f-56c206fd3bf0/Movies_Not_Shared

Plex scans the library but unfortunately does not show any of my old metadata. For example, any information I had previously entered for any movies Summary data. Nor is any viewing history evident.

This leads me to conclude that the /srv/4136d90d-2d76-4434-890f-56c206fd3bf0 path is NOT the same path embedded in the old Plex data.

I’ve used this technique many times over the years and never had a problem. I had planned to abandon it but decided to try it one more time in hopes of saving time and besides it ain’t broke. Well, now it’s broke.

So I’m thinking I need to find out what the old path is, which I assume must be somewhere in the plex data. Is there any way I can examine the plexmediaserver dir and subdirs to find the old media path? I’ve tried hunt and peck but so far no luck.

Thanks!
Mark

Mark,

you’ll need to dump the old database to a SQL text file then pull into a text editor and start searching for path fragments.

It shouldn’t take long at all. You’ll see entire pathnames.

Thanks! Would you point me to any articles that could help me with this? Last time I used SQL against the database was too long to remember.

as root,

get into the Databases directory

sqlite3 com.plexapp.plugins.library.db .dump > /home/mydir/plexdb.sql

Thanks!

Hey Chuck - I found the old path in the old data and I’m still not getting old metadata on scan.

Here’s the old path embedded in old data:
INSERT INTO “media_parts” VALUES(234915,172030,14903,‘205d74b315af800f4e5229599768af31f31a7e7a’,‘b52b2f25cc44a106’,’/srv/8082201b-fbdf-4593-b91c-7d81eac4e076/Movies_Not_Shared/Parasite (2019)/Parasite (2019).mkv’,NULL …

Yet when I add /srv/8082201b-fbdf-4593-b91c-7d81eac4e076/Movies_Not_Shared to the library path and run a scan, the movie Parasite (2019) still doesn’t show my old metadata or the fact that I’ve viewed the movie.

Is there something I’ve missed in the steps I’ve shown?

Oh, and just to be clear, I created this symlink before adding the folder:
ln -s /srv/e76ca4aa-eacc-44bd-a213-0fdb8ca9f852 /srv/8082201b-fbdf-4593-b91c-7d81eac4e076

you should make a dummy directory:

/srv/8082201b-fbdf-4593-b91c-7d81eac4e076

next,

mount --bind /srv/8082201b-fbdf-4593-b91c-7d81eac4e076 /srv/new-path-name

I will try that. So you see nothing wrong with what I’ve done so far? Other than using mount --bind rather than ln?

Been using ln without a problem many times but of course I’ll do as you suggest. Just not clear on the difference.

I use mount --bind when I can because, this way, the link count is hidden.
Applications can’t tell their top-level directories were relocated (like a chroot)

No can do. mount --bind somehow interferes with mergerfs. After

mount --bind /srv/8082201b-fbdf-4593-b91c-7d81eac4e076 /srv/e76ca4aa-eacc-44bd-a213-0fdb8ca9f852

/srv/e76ca4aa-eacc-44bd-a213-0fdb8ca9f852 no longer has directories underneath it, like Movies_Not_Shared, etc.

The only way I’ve found to recover is to delete the path created by mergerfs (/srv/e76ca4aa-eacc-44bd-a213-0fdb8ca9f852) and rebuild mergerfs path. That yields a new name, which is fine, and the merged drives appear under it. But I can’t see any way to use mount --bind when it clobbers mergerfs.

So … I think I have to stick to symlinks. I just don’t get why that approach is no longer working. Keep feeling I’ve skipped something but I’ve got my steps well documented (I note exactly what I did everytime I reinstall OMV) and I’m following them exactly. No errors. Just no new metadata.

What the heck?

Ok., then you’re stuck.

if the new path is: /srv/e76ca4aa-eacc-44bd-a213-0fdb8ca9f852

and the old path is: /srv/8082201b-fbdf-4593-b91c-7d81eac4e076

you need to create symlink:

ln -s /srv/e76ca4aa-eacc-44bd-a213-0fdb8ca9f852 /srv/8082201b-fbdf-4593-b91c-7d81eac4e076

If that’s not working due to the mergerfs FUSE filesystem then you’re out of luck.

I hear you, but it’s not mergerfs at fault. I’ve been using this technique for years. He gets along fine with symbolic links.

I’m now at the point where I’m going to back to basics, to ensure I haven’t missed anything. I think it’s fair to consider the steps given in ‘Move an Install to Another System ’ are applicable to my scenario. I have my old Plex data, it’s on a different drive than the default location on the rebuilt server. Other than the fact that I’m on the same machine, I see no pertinent difference.

The Move … instructions say you can install a new Plex server (destination), then exit out of the browser immediately. Then copy old data into new location and restart Plex. Then it says ’ … you should see your libraries …’. I don’t. Then it says under ‘Edit Your Libraries’ you can add new folder locations. It implies that the old folder locations should be visible. But they’re not. I have to add a Library (like Movies_Not_Shared) and I have to Browse to add folders.

Since they’re not visible, I figure I have to go through some fakery (symlinks) to point to the old folder locations. And then on we go with ln vs mount --bind etc.

So why is it that my old folder locations (or ANY locations) are not visible in Plex even though I’ve replaced the new plexmediaserver data with the old?

Being on a different drive shouldn’t matter unless OMV does something bizarre.

Problems like this contributed to me never being able to get it running in a VM and approved for Plex use as supported. FAR too many difficulties.

You’re at the point of needing help in their forums.

Okay, thanks Chuck!

Hi Chuck @ChuckPa ,

I’ve had this issue for a while now and didn’t know where to go for help. Something happened with my hard drive that had all of my plex music movies and videos. i was able to get a new hard drive but now every time i want to click on anything it gives me an error code. Do not know where to go from here.

1 is there any hope of recovering my files?
2 how do i connect my new hard drive to existing plex server?