Plex media server backup and restore - My experience so far

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.

Hi Duyi, thanks for your post. I am trying to do the same thing, but I cannot connect to my Plex server to issue the commands. It looks the plex backup is stored under the folder /data/user/0/com.plexapp.mediaserver.smb/Plex Media Server/Plug-in Support/Databases in My Cloud Home, and I am trying to access it via Windows but to open the dialogue with the server I assume I need to use first an SSH command. Everytime I try an SSH command the server responds with “connection refused”. How did you communicate with your server in the first place to start using the Linux commands to it? Thanks, Manolo

You will need to enable SSH on your My Cloud Home first. On windows I like to use PUTTY. SSH uses a different account and password from all other accounts. The only allowed user is “sshd”. You can’t change it.

This may be slightly different depending on model and firmware version!
Log in to your MyCloud web panel.
Go to Setting >> Network
Under “Network Services” Turn SSH to “ON”
Then click “configure” and set a password.

Be sure to use a strong password. SSH is the key to the kingdom and you can do a lot of damage if you aren’t careful.

Thanks Duyi. I am talking about rye My Cloud Home which cannot be accesed vía any panel. I assume you might not be familiar with this model?

Does this effect the media within the Public folder?

This is to back up things like settings, the database, and thumbnails. This has nothing to do with the media.

1 Like