Backing Up Plex DB Daily

Plex support is scattered, often out of date, and difficult to find answers to specific questions. Therefore, I post this both as a request for help as well as for suggestions.

There is a setting in Plex's control panel to back up the database every three days. Well, I'm making many changes to my media entries, and twice have had to restore from a backup, losing work in the process. There doesn't seem to be a way to back up the database through the settings, so I thought I'd try my own "outside the box" solution.

On my MATE 20.04 LTS server, my Plex databases (there are two) and their three most recent backups are located in /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/. The current files (SQLite3) are listed with a .db extension. The backups are date-stamped.

Reversing the restore process, this is my thinking: create a script that performs the following:

All commands must be run via sudo

  1. Using systemctl stop plexmediaserver to bring the Plex server down
  2. Copy the current files to the same directory, giving them a new extension (so as to not conflict with Plex's own process. Something like $(date +%m%d%y).bak
  3. Restart Plex systemctl start plexmediaserver

Restoration then can be achieved using the latest valid backup.

Sound good? Am I missing anything? Is there a better way of doing this?

1 Like