Restore Plex Server Database on NVidia Shield

My PLEX server crashed due to a power failure.
My plex server is on an Nvidia Shield.

The server wouldn’t start.

I managed to recover it without any loss of data.
If you’re interested in the procedure, I can describe it here.
Please leave a comment or send me a message if this is of interest to the community.

I would be interested to know the details, as I am sure others would be too. Thanks!

Version française en dessous.

Hope it helps.

Configuration:
Plex Server installed on NVIDIA SHIELD PRO 2019
Plex Server storage location: Internal (System)
Storage on NAS SYNOLOGY DS218+
Plex Server remote access enabled.

Here is the context:
Power failure.

Symptoms :
the plex server seems to be unresponsive.
After checking app.plex.tv it appears offline.

First repair attempt:
Try to trigger the Plex server configuration page, without deleting it:
Load the “supplied version of Plex Web App” on your server computer using http://localhost:32400/web or http://127.0.0.1:32400/web
→ Failed: access denied.

Second attempt:
Clear the Plex application cache from the Shield, by going to Settings/Application. I’m talking about the PLEX application, not the Plex Server. Be careful, only clear the cache, not the data.
→ Failed

Third attempt:
Delete the PLEX application
→ Failed.

New finding:
Connect to NVIDIA Shield to access files.
Settings / Device preferences / Storage / Transfer files to local network.
→ a login / password will be provided.

Once connected, navigate to :
/internal/Android/data/com.plexapp.mediaserver.smb

I see that my directory is empty, except for the “cache” directory. No configuration files are present.
I also notice that in the law files present on the SHIELD in /Volumes/internal/Plex Media Server/Logs, I have this: Startup Crash.log : Nov 29, 2023 16:47:24: Failed to initialize logging: Empty or non-existent file.

Conclusion: my server is dead. :sob:

Luckily (or not), the database backup is active.
The backups are here: internal/Plex Media Server/Database Backups

Procedure:

1 - Recover backups :
a- Connect to the NVIDIA Shield to access its files.
Settings / Device preferences / Storage / Transfer files to local network.
→ a login / password will be provided.
b- copy the 2 most recent files to your machine (the numbers at the end of the file name correspond to the date of the backup). There are 2 types of files: library.blobs.db and librarydb
com.plexapp.plugins.library.blobs.db-2023-11-28
com.plexapp.plugins.library.db-2023-11-28

2 - Remove Plex Server: (we’re starting to sweat a bit)
No need to reset the NVIDIA SHIELD for this.
a- Go to Settings/Applications then “Show all applications” and finally “Show system applications”.
b- Search for “Plex Media Server” and click “Uninstall”.

3 - Install Plex Server :
a- From the Play Store, search for Plex Media Server and install it.

4 - Reboot
a- A reboot doesn’t hurt, just do it.

5 - Configuring the new server
a- Launch Plex, and you should be returned to the server configuration page.
b- Act as if you were creating a new server.
c- Don’t add a library, it’s useless.

6 - Change the location of the server configuration (without this you cannot replace the database backups).
a- from the Plex client go to Settings
b- scroll down to the “Plex Media Server” section: select “Storage location”.
c- Follow the instructions and choose “Internal (user)”: the server will move its configuration, which will now be accessible to you by connecting to the NVIDIA SHIELD to access its files (as you did in step 1a).
d- if you look at the /internal/Android/data/com.plexapp.mediaserver.smb folder on the NVIDIA SHIELD you’ll see that a new folder has appeared: /Volumes/internal/Android/data/com.plexapp.mediaserver.smb/Plex Media Server. And that’s cool! :slight_smile:
e- Let it work for 5/10 minutes to give it time to rebuild its tree structure.

7- Copy the database backup files
a- Stop the server: go to NVIDIA SHIELD in Settings/Applications then “Show all applications” and finally “Show system applications”.
b- Search for “Plex Media Server” and select “Force stop”.
c- access the NVIDIA SHIELD file here: /Volumes/internal/Android/data/com.plexapp.mediaserver.smb/Plex Media Server/Plug-in Support/Databases
d- delete files (or move them to your machine). The directory must be empty before copying your backups.
e- Rename your backup files before copying them as follows:
com.plexapp.plugins.library.blobs.db-2023-11-28 becomes com.plexapp.plugins.library.blobs.db
com.plexapp.plugins.library.db-2023-11-28 becomes com.plexapp.plugins.library.db
f- copy them to the Databases folder
g- restart NVIDIA SHIELD

*8- Your old server is back.
a- give the PLEX server 2 or 3 minutes to start up.
b- launch the PLEX client
c- if all goes well, you should see the list of your libraries. If not, go to “More…” and you should see the list of available servers and their libraries.
d- at this stage, I noticed that all the visuals were missing (more on this later).
e- connect to app.plex.tv, go to settings and check that your old server is accessible.
f- you can delete the new server, which no longer serves any purpose.

9- Rebuild metadata (visuals, etc…)
a- from app.plex.tv, for each library, click on “…”, “manage library” then “update all metadata”.
b- this will take a few minutes, depending on the size of your libraries.

Conclusion :
the server is back
server shares with your friends are still active
you’ve kept your player history (viewed/unviewed)
server configuration has been recovered (agents, etc…)
you’ve avoided a full scan of your media, which takes days…


En esperant que cela puisse aider.

Configuration :
Server Plex installé sur NVIDIA SHIELD PRO 2019
Emplacement de stockage Plex Server : Internal (System)
Stockage sur NAS SYNOLOGY DS218+
Accès distant du serveur Plex activé.

Voici le contexte :
Coupure de courant.

Symptomes :
le serveur plex semble ne plus répondre.
Apres vérification sur app.plex.tv il apparait offline.

Première tentative de réparation :
Essayer de déclencher la page de configuration du serveur Plex, sans le supprimer :
Chargez la « version fournie de Plex Web App » sur votre ordinateur serveur en utilisant http://localhost:32400/web ou http://127.0.0.1:32400/web
→ Echec : accès refusé.

Deuxième tentative :
Vider le cache de l’application Plex depuis la Shield, en allant dans Paramètres/Application. Je parle de l’application PLEX et non pas du Serveur Plex. Attention, vider uniquement le cache , pas les données.
→ Echec

Troisième tentative :
Suppression de l’application PLEX
→ Echec.

Nouveau constat :
Se connecter à la NVIDIA Shield pour accéder à ses fichiers.
Paramètres / Préférences relatives à l’appareil / Stockage / Transférer des fichiers sur le réseau local.
→ un login / mot de passe vous sera fournit.

Une fois connecté, naviguez dans :
/internal/Android/data/com.plexapp.mediaserver.smb

Je constate que mon répertoire est vide à l’exception du répertoire “cache”. Aucun fichier de configuration n’est présent.
Je constate également que dans les fichiers de lois présent sur la SHIELD dans /Volumes/internal/Plex Media Server/Logs, j’ai ceci : Startup Crash.log : Nov 29, 2023 16:47:24: Failed to initialize logging: Empty or non-existant file.

Conclusion : mon serveur est mort.

Par chance (ou pas), la sauvegarde de la base de données est active.
Les sauvegardes sont ici : internal/Plex Media Server/Database Backups

Procédure :

1 - Récupérer les sauvegarde :
a- Se connecter à la NVIDIA Shield pour accéder à ses fichiers.
Paramètres / Préférences relatives à l’appareil / Stockage / Transférer des fichiers sur le réseau local.
→ un login / mot de passe vous sera fournit.
b- copiez les 2 fichiers les plus récents sur votre machine (les chiffres à la fin du nom du fichier correspondent à la date de la sauvegarde). Il y a 2 type de fichiers : les library.blobs.db et les librarydb
com.plexapp.plugins.library.blobs.db-2023-11-28
com.plexapp.plugins.library.db-2023-11-28

2 - Supprimer Plex Server : (on commence à transpirer un peu)
Pas besoin de réinitialiser la NVIDIA SHIELD pour cela.
a- Allez dans Paramètres/Applications puis “Afficher toutes les applications” et enfin “Afficher les applications système”.
b- Recherche “Plex Media Server” et faites “Désinstaller”.

3 - Installer Plex Server :
a- Depuis le Play Store, recherchez Plex Media Serveur et installez-le.

4 - Redémarrage
a- Un redémarrage ne fait pas de mal, faites le.

5 - Configuration du nouveau serveur
a- Lancez Plex, vous devriez retomber sur la page de configuration du serveur.
b- Faites comme si vous vouliez créer un serveur.
c- N’ajoutez pas de bibliothèque, c’est inutile.

6 - Changer l’emplacement de la configuration du serveur (sans cela vous ne pouvez pas replacer les sauvegardes de la base de données).
a- depuis le client Plex allez dans paramètres
b- détendez jusqu’à la Section “Plex Media Server” : Sélectionnez “Emplacement de stockage”
c- Suivez les instruction et choisissez “Internal (user)” : le serveur va déplacer sa configuration qui sera désormais accessible pour vous en vous connectant à la NVIDIA SHIELD pour accéder à ses fichiers (comme vous l’avez fait en étape 1a).
d- si vous regardez le dossier /internal/Android/data/com.plexapp.mediaserver.smb de la NVIDIA SHIELD vous verrez qu’un nouveau dossier est apparu : /Volumes/internal/Android/data/com.plexapp.mediaserver.smb/Plex Media Server. Et ça c’est cool ! :slight_smile:
e- Laissez le travailler 5 / 10 minutes pour lui laisser le temps de reconstruire son arborescence.

7- Copier les fichiers de sauvegarde la base de données
a- Il faut stopper le serveur : allez sur la NVIDIA SHIELD dans Paramètres/Applications puis “Afficher toutes les applications” et enfin “Afficher les applications système”.
b- Recherche “Plex Media Server” et faites “Forcer l’arrêt”.
c- accèdez au fichier de la NVIDIA SHIELD ici : /Volumes/internal/Android/data/com.plexapp.mediaserver.smb/Plex Media Server/Plug-in Support/Databases
d- supprimer les fichiers présents (ou déplacez les sur votre machine). Le répertoire doit être vide avant de copier vos sauvegardes
e- Renommez vos fichiers de sauvegarde avant de les copier comme cela :
com.plexapp.plugins.library.blobs.db-2023-11-28 devient com.plexapp.plugins.library.blobs.db
com.plexapp.plugins.library.db-2023-11-28 devient com.plexapp.plugins.library.db
f- copier les dans le dossier Databases
g- redémarrez la NVIDIA SHIELD

8- Votre ancien serveur est de retour.
a- laissez 2 ou 3 minutes au serveur PLEX pour se lancer.
b- lancez le client PLEX
c- si tout va bien, vous devriez voir l liste de vos bibliothèques. Si ce n’est pas le cas, naviguez dans “Plus…” et vous devriez voir la liste des serveurs dispo ainsi que leur bibliothèques.
d- j’ai constaté à ce stade, que tous les visuels étaient absents (nous verrons ce point plus tard).
e- connectez vous à app.plex.tv, allez dans les réglages, vérifiez que votre ancien serveur est bien accessible
f- vous pouvez supprimer le nouveau serveur qui ne sert plus à rien.

9- Reconstruire les metadatas (visuels, etc…)
a- depuis app.plex.tv, pour chaque bibliothèque, cliquez sur les “…”, “gérer la bibliothèques” puis "Actualiser toutes les métadonnées "
b- ca va prendre quelques minutes en fonction de la taille de vos bibliothèques

Conclusion :
le serveur est de retour
les partages de votre serveur avec vos amis sont toujours actifs
vous avez conservez votre historique de lecteur (vu/non vu)
la configuration du serveur a été récupérée (agents, etc…)
vous vous êtes évitez un scan complet de vos médias qui prend des jours…

Oh wow. This is brilliant! Thank you so, so very much for such a thoughtfully written and detailed walkthrough. I think it will be immensely helpful to a very wide audience. A lot of users, myself included, have been dealing with dead servers for a variety of reasons (see, for example, this thread about servers irretrievably crashing when an external drive is ejected).

I will try this method out on my crashed server in the next few days and report back. Thanks again!

Thanks @Anjadekar :pray: I’d be delighted to receive your feedback to complete the procedure. So many different things can happen along the way…

As presciently foretold by you, a lot did happen along the way! I was able to get the database backups and remove and reinstall the server but am unable to go any further. Any attempt to create a new server fails and I get the dreaded “Plex Media Server - Setup Failed” screen. I have tried the following:

  • Running the setup on after updating PMS and with the stock included PMS after uninstalling it
  • Checking and unchecking the “Create default libraries for PMS” option
  • Removing all Authorised Devices (including servers) from my Plex account
  • Removing my external hard drive while setting up PMS

Looks like a reset of the Shield might be my only way out :-/ I will then try and continue with your steps once I have a PMS is up and running. I am very curious to hear if you think there is anything else I can try. Many thanks!

Hi there!
Yes, the starting point is to have a healthy PMS.
It’s very curious what’s going on. I’ve never come across this case.
If you can reset the Shield to attempt a clean installation, that would be great.
The rest should go as planned :slight_smile: