Server Version#: 1.42.2.10156
Player Version#: N/A
I reinitialized my QNAP TVS-882 for reasons. Before I did this I verified that I had backups of the Plex database(s) - this was honestly all I thought I’d need - but for good measure I made a copy of the PlexMediaServer folder as well.
I’m using a different admin user ID to set up the NAS and install applications. I installed Plex after downloading the QNAP version from Plex’s webpage directly. Then I stopped Plex and replaced the two database files, connected via SSH and did chown and chmod to give the restored DB files the same owner and permissions as the rest of the new Plex installation.
Plex starts, I can log in to the web site using the local address, it seems like at least some of my old configuration settings are back such as the library access I’ve granted other users but there are no libraries.
What do I need to do to “restore’ my libraries and not start over with new ones?
I’ve moved between platforms and devices and did the same thing as you: copied the contents of the plex media folder after installing fresh version and stopping it and then restarting it. I think I just had to add the new media folder paths (with permissions set correctly on them) to the existing libraries without removing the old folder paths Plex “remembered” and it lined up. I then removed the old paths from the library. If you have the exact same locations\paths it might just be a permissions setting on those media folders.
I only restored the two DB files, I did not overwrite the new installation with my backup of the PlexMediaServer folder. My Plex server was installed on this QNAP 7 or 8 years ago so I wanted to start as fresh as possible. Perhaps that’s a unnecessary thought, but I wanted to bring over the minimum from the old installation.
EDIT: Saying that I wanted to start as fresh as possible probably gave the wrong impression. I want to restore my whole Plex system to it’s previous configuration/state. I just don’t want to bring over any unnecessary clutter than may have been in the old PlexMediaServer Folder.
Information that uniquely identifies your system to Plex is stored in Preferences.xml. If you do not restore it, Plex will consider it a new server, even if you give it the same name.
After you restore the Plex Data Folder, but before starting Plex Media Server, edit Preferences.xml and add/edit autoEmptyTrash="0". This will stop PMS from potentially deleting the movies/shows/etc. in your libraries (*).
Library definitions are stored in the Plex database files. However, who you invite, etc. are account settings stored on systems at plex.tv. That is why you see the access granted to others, even if there are no libraries (**).
* If PMS is configured to auto-delete and the library paths are different, then PMS will delete the contents of the library when it starts.
** If you do end up creating new libraries, you will not have to re-invite users. You will have to share the new libraries with them, they will have to pin the new libraries to their home screen, etc.
Restore the entire backup. (there’s no easy way of tracking which individual files are needed out of the Metadata and Media directories
If you want to start if fresh, Create a new Preferences.xml
This lets you break from all the shared users.
The only thing you’ll need do is go to https://app.plex.tv/desktop/#!/settings/devices/pms
and REMOVE the old instance of the same hostname
sudo bash # This gets you to root (admin) level
cd /share/*/.qpkg/Ple*/Li*/Ple* # This exploits wildcard matching into PMS data
chown -R admin:admin .
find . -type d -exec chmod 755 {} \; # this takes some time
find . -type f -exec chmod 644 {} \; # this will take more time
I’m getting stymied trying to complete the restore. When I try to copy or extract my PMS folder backup over the top of the existing, new PMS installation I am getting what I believe are security/permission errors. I am logged on as an admin user, not THE admin since its disabled, but an admin none-the-less.
My Linux knowledge is just enough to do simple things but I run in to limits pretty quick. Any help would be appreciated.
Part of the restore requires you be THE admin.
When ‘admin’ is disabled, sudo bash on the command line elevates your administrative user to ADMIN level.
Now, at that # prompt, you have sufficient privilege to extract and overwrite the files which already exist
It looks like this:
[chuck@lizum glock.2019]$ ssh chuck@ts128
[chuck@ts128 ~]$
[chuck@ts128 ~]$
[chuck@ts128 ~]$ whoami
chuck
[chuck@ts128 ~]$ sudo bash
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
Password:
[admin@ts128 chuck]# whoami
admin
[admin@ts128 chuck]# cd /share/*/.qpkg/Ple*/Li*/Ple*
[admin@ts128 Plex Media Server]# pwd
/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server
[admin@ts128 Plex Media Server]#
I’m going to take a break for the night. Tomorrow I can continue to troubleshoot if you’re still willing to help. I can also remove Plex from the NAS and start the process over again. It may give me more clarity on what’s where.
Side question, I notice there are two ‘Plex Media Server’‘ directories, at least on my system. There is:
/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/
and
/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server
In our conversations I have always been referring to the top level directory, were you talking about the second? That could have screwed me up.
Yes, the /* indicates “the contents of”. It will not copy hidden (dot) files.
In this case , that’s ok because PMS doesn’t use them
My mistake for missing the /* . Sorry
Re: /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server
It’s confusing on QNAP (and most NAS systems). I will break it down for you.
/share/*/.qpkg/PlexMediaServer = whichever DataVol PMS is installed on
QNAP always installs packages under .qpkg on the assigned DataVol.
This is where we will find all the PMS executables.
[~] # cd /share/*/.qpkg/Ple* # The wildcard works because only one Plex install per system.
[/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer] # ls
CrashUploader* Plex DLNA Server* plex-orig.sh* plex.sh* Plex Transcoder*
lib/ Plex Media Fingerprinter* Plex Relay* plex.sh-new* Plex Tuner Service*
Library/ Plex Media Scanner* plex-save.sh* plex.sh-orig* Resources/
Plex Commercial Skipper* Plex Media Server* Plex Script Host* Plex SQLite*
[/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer]
Library = the subdirectory PMS uses to store your PMS server’s data (the actual databases & metadata). This is also known as the Application Support Directory on other systems
–Regular Linux uses /var/lib/plexmediaserver/Library/Application Support
Plex Media Server is where PMS creates its instance directory and stores all its internal files. This is common to all MacOS and Linux systems (pretty sure on Windows too)
Yes, I wrote it to be an as-is.
What wasn’t clear to me is whether we’re restoring PMS or making the backup
To be clear
If you have /share/CACHEDEV2_DATA/Videos/Plex/Plex Media Server
and want to restore from the backup
and all of PMS’s internal data is under Plex Media Server
Then we copy it back into the QPKG package area with:
# Go to where 'Plex Media Server' is
cd /share/CACHEDEV2_DATA/Videos/Plex
# Copy the 'Plex Media Server' directory from here to where it belongs.
cp -rpf "Plex Media Server" /share/CACHEDEV2_DATA/.qpkg/PlexMediaServer/Library
I do copies like this to:
Keep pathnames short and separated (two shorter commands)
cd then cp -versus- a long cp with paths in it which are more error prone
Huge progress made. I started from scratch, used your commands carefully, and the server is up and running. Only issue to solve now is that it says the libraries are inaccessible. Libraries are in the same place they used to be. Must be a permissions issue. I’ve repointed a library to the correct folder again and that doesn’t help.