How do I backup my Plex data (not media) on Synology NAS with DSM7?

In the past I made regular back-ups of the Plex data / library following the recommendation of the thread How do I backup my Plex data (not media) on Synology NAS?

But since I migrated to DSM7 my Plex folder is empty and the Plex server data is somewhere hidden.
Any hinds / recommendations how to handle backup with DSM7?

1 Like

I’m looking for the same. Makes me nervous not being able to perform a nightly backup.

@Chad-Smith

If you’re referring to DSM 7, you can relax.

I know there is no direct access to a shared folder like there used to be


As I’ve stated elsewhere in the DSM 7 threads.

  1. Now that DSM 7 is actually stable –
  2. I can go back to providing the next set of package features (a full set)
    a. Backup
    b. Restore
    c. Import

I had to suspend development work, which was nearly completed, when the future state of DSM 7 was in flux.

If you really need a short term ‘hack’, I can tell you how to do it.
It won’t work for restoring but does work for backups.

Curious how to do it?

Thanks for helping. I actually found this:

https://forums.plex.tv/t/synology-dsm-7-release-plex-installation-issues/719845/272?u=qqldd

This works for me as of now.

Thank you!

Besides there seems to be no solution for my main question.
Nevertheless

Where / how can I find the Plex software files on my Synology NAS?
Where is it hidden?

I know it has been a while, is there any update on where the database files are stored on synology? I can download a copy of the database but what do I do if I need to restore it? I have looked around in the documentation and forum posts and I can’t find anything about where the actual database file is located.

@drrl1806

To add to Trumpy,

When you install PMS 1.24.2.4973 or higher, the data is automatically moved to the new, visible, PlexMediaServer shared folder.

For some users this is instantaneous while for others it does take a few minutes.

Be patient with it – It won’t “Hang”.

You’ll be able to use HyperBackup or whatever you wish to do backups after that.

@ChuckPa , that makes sense, I was looking for a database file. It sounds like I can just backup and restore that entire shared directory if needed.

@drrl1806

There are many users who have custom posters, etc, representing hundreds of hours curating. Just backing up the database would be insufficient.

That’s why I pushed to make it all available.

You know what your needs are and can now do what works best for you.

That makes sense, I didnt get that until now.
Thanks

@ChuckPa
Under DSM 6, I understood that I had to stop the plex server before running hyperbackup to backup the plex shared folder. Is this still the case in DSM 7 or can I simply use hyperbackup to backup the entire PlexMediaServer/AppData/Plex Media Server folder without first stopping the Plex Server

@Charlie56

For safest backup – Yes. Stopping Plex prior to the backup shuts down and flushes the database to disk ensuring you get all the data records intact at next start.

If you have to, you can back it up live but I wouldn’t recommend it as I can’t predict how it will behave for you.

If you’re backing up to the cloud and have a slow upload (less than 500 Mbps), and the NAS is busy, you’re going to get a database snapshot which is in flux & otherwise inconsistent between file fragments – that’s not cool.

If you’re at home, on 1 or 10 GbE, backing up to a drive which can accept the DB in less than 1-2 seconds, your chances of corruption diminish dramatically.

Thanks ChuckPa. I will stop Plex server before backup to be safe.

Processing: Plex_Backup.sh

I wonder f you can help ChuckPa. I have a script that stops Plex, Copies the Plex directory to a tar file and the starts plex. This used to work on Synology DSM 6. I’m finding with DSM 7, that Plex stops, the tar file is created, and while it says it is starting Plex, it doesn’t actually Start plex again.

My script is:
#!/bin/sh

# Stop Plex while we make the backup
"/var/packages/PlexMediaServer/scripts/start-stop-status" stop

# Make a full backup of all the metadata, configuration, and databases
tar cfz /volume1/Plex-Backups/plex_backup.tar /volume1/PlexMediaServer/AppData --exclude=/volume1/PlexMediaServer/AppData/PlexMediaServer/Cache

# Restart PMS
"/var/packages/PlexMediaServer/scripts/start-stop-status" start

# Set the permissions on the backup file so they can be accessed by the admin user
chown admin.users  /volume1/Plex-Backups/plex_backup.tar

Moderator Edit: Make code legible

DSM 7 will not let you do what you want.

Synology took away all root privileges from us.

Further, you / we can’t launch PMS manually AND have it connected into Package Center . the PlexMediaServer shared folder . or hardware transcoding. Synology has it setup such that they are in full control and aren’t letting go.

The best you can hope for is HyperBackup.

I do have some ideas but not sure if it’s going to be supported across multiple DSM 7 versions.

Here is the best known way to do what you want

Running as root

  1. Determine package status: synopkg status PlexMediaServer
  • ret: PlexMediaServer package is started
  • ret: PlexMediaServer package is stopped
  1. Stop PlexMediaServer: synopkg stop PlexMediaServer
  • ret: {"action":"prepare","error":{"code":0},"stage":"prepare","success":true}

  • meaning: error code: 0 (no errors)

  • Observe: ps -ef | grep -i plex returns no processes

  1. Start PlexMediaServer: synopkg start PlexMediaServer
  • ret: {"action":"prepare","error":{"code":0},"stage":"prepare","success":true}

  • meaning: error code: 0 (no errors)

  • Observe: ps -ef | grep -i plexx returns list of processes

This allows DSM 7 to retain full control while using the approved API.

Disclaimer: synopkg can do a lot of other fuctions. Please be extremely careful.

I have been running this synology .sh task. It seems to be stopping plex, copy files using rsync, start plex. I run a hyperbackup later to copy the files a different NAS. I haven’t tested recovery yet.

======================================================================
#!/bin/sh

#Stop Plex while we make the backup
synosystemctl stop pkgctl-PlexMediaServer.service

#Make a full backup of all the metadata, configuration, and databases
rsync -ar --exclude=‘Cache’ “/volume1/PlexMediaServer/AppData/Plex Media Server/” /volume1/Backup/Plex/

#Restart PMS
synosystemctl start pkgctl-PlexMediaServer.service

1 Like

I love your code - thank you. It does what I want.

But it only works if I use the sudo command before synosystemctl.

This makes is challenging to automate this backup every night.

Any advice for running this script without requiring sudo, or some other fix so this can be a scheduled task that runs in the middle of the night without me needing to manually run it? Thanks!

If I may make a suggestion?

DSM 7 – HyperBackup makes a perfect backup as well.

When it restores, it will do ALL the work for you.