I make NO guarantees but I did my best to document steps both for me and for other users. AS WD points out using ssh can do real harm to your system. Use at your own risk.
I have been backing up my Plex server using this command. I set it up to name each backup with the date and put it into a tar file for easy transfer. It’s saved in a folder on my public directory that I then manually move to my PC for safekeeping. Stop Plex media server before you back it up or restore it.
tar -zcvf “/mnt/HD/HD_a2/Public/bak/plex/plex_conf$(date ‘+%Y-%m-%d’).tar.gz” /mnt/HD/HD_a2/Nas_Prog/plex_conf/
Above is the backup portion. If you are just backing up Plex stop here and save the backup somewhere safe. If you didn’t backup before a crash you may be out of luck.
If you need to restore Plex start here. This guide assumes you have a backup file in your Public folder.
I had the unfortunate need to restore my backup tonight. I recorded each step of the process and here it is. NOTE: There are some changes you would need to make to restore the backup so don’t try to copy and paste the whole thing without reading the notes. This assumes you created a backup using my script. If you did not you will have to adjust the untar process to match the file structure you used during backup. This may also give you problems if you are moving from another system but it gives you a good outline of what is going on. This is a full backup. You can do a much leaner backup if you like. My backup file is a few gigabytes with meta data, watch history, posters, and cover art but no media.
To start I reinstalled Plex using the WD app installer. I opened it after install and went through the basic setup without adding any media. Once done I went into the WD App manager and stopped Plex. I then restored my media.
I enable ssh and logged in using Putty.
Backup stock plex_conf folder - Not 100% needed but just to be cautious.
tar -zcvf “/mnt/HD/HD_a2/Public/bak/plex/plex_conf_original.tar.gz” /mnt/HD/HD_a2/Nas_Prog/plex_conf/
Delete stock “Plex Media Server” from plex_conf folder
rm -r “/mnt/HD/HD_a2/Nas_Prog/plex_conf/Plex Media Server/”
Restore from backup making sure to substitute actual backup .tar file name and location This assumes the file structure is the same! It will take a while to extract.
tar -C / -xvf /mnt/HD/HD_a2/Public/bak/plex/plex_conf2019-12-10.tar.gz
Remove com.plexapp.plugins.library.db-shm
rm “/mnt/HD/HD_a2/Nas_Prog/plex_conf/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db-shm”
Remove com.plexapp.plugins.library.db-wal
rm “/mnt/HD/HD_a2/Nas_Prog/plex_conf/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db-wal”
Restart Plex!
I hope this helps others. Feel free to use my backup script. You never know when you’re going to need it. It’s just the one line pasted into your favorit ssh client and it’s at the top of the post.