I’m looking to start backing up my Plex Media Server (should’ve done this years ago!) and I found that my /$PMS_HOME/Plug-in Support/Databases folder has what appears to be weekly db backup files. The files I’m seeing are named like this:
These files have weekly iterations dating back to 2022, for a total of nearly 170GB! Is there a data pruning bug in PMS resulting in these files existing and not being pruned? What is expected behavior? Am I safe to assume I can backup all these *-tmp files? Without deleting these I won’t even have the ability to create a tar backup on the same disk!
And if there is by chance a configuration I may have set to cause such a thing to occur please let me know! I have a cron server that will begin doing these weekly backups and placing them onto my NAS, so I have no need for any kind of on-box backups going forward. Thanks!
On Linux anyway, if the backup directory isn’t OWNED by plex, then it will write the backup files but it will NOT be able to prune them–even if the directory r/w permissions are wide open.
This seems like a bug to me, but perhaps there is a galaxy brain reason why this is intended behavior.
Thanks @BanzaiInstitute. Yeah, this is definitely a bug. It should be caught with a notification displayed in the web ui.
@FordGuy61 I actually pruned all the files. But they all had the same naming structure as yours, except they were every 7 days and had a “-tmp” at the end, and they went back, one per week, to 2022-06-22. (Which presumably is when I enabled this database backup maybe, and likely the date when I built this PMS.)
While I am sure that is true, it is also true in my experience that if the backup directory is not owned by the plex user, backups are written out but not cleaned up. When I had the same problem as OP I googled it and found a Reddit thread revealing the solution. After making the user/group ownership change on the backup directory, pruning worked as expected and has kept working for a year or so.
The pertinent lines are:
Note 1: PMS must be stopped.
Note 2: Adjust accordingly if running Plex using a different user/group or files are in a different location.
Change the ownership of the files to the Plex user on the Linux host.
# chown -R plex:plex "/var/lib/plexmediaserver"
Make certain Linux file permissions are set correctly
# find /var/lib/plexmediaserver -type d -exec chmod 755 {} \;
# find /var/lib/plexmediaserver -type f -exec chmod 644 {} \;
My overall Plex Media Server install is about 150GB, even with the database issue pruned out now. Is it normal for an install to be that gigantic? I do have thousands of Movies & TV Shows and tens of thousands of albums indexed, so maybe yes? Are there any folders that can be omitted from the backup safely? I wouldn’t want to purge any manually created elements (such as manual artwork and tagging for home movies) but I’d be OK with letting the various metadata agents running to download all the other stuff again in the event of an actual disaster recovery, just to keep these backup files smaller (and the backup job quicker!).