My Plex server crashed so here is how I migrated the information over.
First Steps
- Install Debian on a new server
- Access to old hard drive or a Plex backup
Server Information
- Old Server
- User: plex
- Media Content
- /PLEX
- Database/Metadata
- /var/lib/plexmediaserver/Library/Application Support
- New Server
- User: PlexServer
- Media Content
- /media/root/8e0e4980-0e2a-4183-d10b2b9c4329/Data
- Database/Metadata
- /var/lib/plexmediaserver/Library/Application Support
Steps
- Connect the non booting hard drive to the new server and copy the media content
- I created symbolic link to “trick” the system in thinking the data is stored in /PLEX
ln -d -s /media/root/8e0e4980-0e2a-4183-d10b2b9c4329/Data PLEX
- Next stop the service
systemctl stop plexmediaserver
- Rename the old /var/lib/plexmediaserver/Library/Application Support/Plex Media Server to OLDPlex Media Server
- Copy the Plex Media Server folder to /var/lib/plexmediaserver/Library/Application Support
- Now since the user is different I need to change the permissions
chown -R PlexServer:PlexServer '/var/lib/plexmediaserver
setfacl -R -m u:PlexServer:rx /media/root
- We also need to edit the plexmediaserver.service file (kinda)
systemctl edit plexmediaserver
- Enter this information with the correct info
User=PlexServer
Group=PlexServer
- Now start the server
systemctl start plexmediaserver
If the service will not start be sure you added the User and Group into the plexmediaser.service file via the command above
- Be sure to edit each of your Plex libraries to update the correct path to your content
- If you get any errors check out /var/log/syslog
- Browse to the server IP to register your server to Plex
http://localhost:32400/web
Note: Be sure to do the above url on your SERVER not from your computer. I tried http://IPADDRESSOFPLEXSERVER:32400/web and that did pull up the login for PLEX however I could not access the server settings. You must do it locally on the server.
When I went to the address above with the port 32400 I got the following message:

This is normal and can take several hours depending on your database size
After getting that same Maintenance message above for 24 hours I decided to reboot the server and was then able to access the server however I needed to Grant Access

Once signed in click the wrench in the upper right corner and find Settings>General
I had to click Claim Server to connect this server to my plex online account

Once that was done I edited each library to my new /PLEX location

If you have issues connecting then you may want to clear your preferences.xml file located at
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml
Locate the following 4 values and clear them out
Before:
PlexOnlineHome="1"
PlexOnlineMail="jane@example.com"
PlexOnlineToken="RanD0MHex1DecIm4LtoKeNheR3"
PlexOnlineUsername="ExampleUser"
After:
PlexOnlineHome=""
PlexOnlineMail=""
PlexOnlineToken=""
PlexOnlineUsername=""
Restart the service or reboot the server and try to connect the server to Plex online again
Reference:
https://support.plex.tv/articles/204604227-why-can-t-the-plex-app-find-or-connect-to-my-plex-media-server/
https://support.plex.tv/articles/204281528-why-am-i-locked-out-of-server-settings-and-how-do-i-get-in/
https://support.plex.tv/articles/201370363-move-an-install-to-another-system/
https://support.plex.tv/articles/202915258-where-is-the-plex-media-server-data-directory-located/
https://ss64.com/bash/ln.html
https://askubuntu.com/questions/676007/how-do-i-make-my-systemd-service-run-via-specific-user-and-start-on-boot