Creating Backups¶
At a minimum, a backup of PhotoPrism should include the files in your originals folder and a copy of the index database. We also recommend backing up the storage folder so you do not need to recreate thumbnail or sidecar files and your backup includes the complete configuration.
The easiest way to create a full backup is to first run the backup command to generate a database dump as shown below. Then back up your originals and storage folders using any standard file backup utility.
Scheduled Backups¶
The default configuration creates daily database backups and retains up to 3 SQL dumps. You can change the schedule, enabled backup types, and retention limits in the backup configuration.
We recommend creating a full backup of all files, including your configuration and index database, before starting a server migration or making any other major changes.
Backup Command¶
If you are using Docker Compose, you can run the following command in a terminal to manually create a new MariaDB or SQLite database backup:
docker compose exec photoprism photoprism backup -i -f
By default, a backup is created in a driver-specific subdirectory such as storage/backup/mysql/[YYYY-MM-DD].sql or storage/backup/sqlite/[YYYY-MM-DD].sql. Omit -f if you do not want to overwrite an existing file with the same name. You can change the backup base folder with PHOTOPRISM_BACKUP_PATH.
If you are using Podman on a Red Hat-compatible Linux distribution, replace docker compose with podman-compose.
Our Advanced Backup Guide shows additional ways to create SQLite dumps.
Custom file names¶
You can specify a custom filename as an argument to store the dump in a file of your choice. Use -f if you want to overwrite an existing file:
docker compose exec photoprism photoprism backup -i my_custom_dump.sql
If you pass only a filename, it is created in the current working directory inside the container, typically /photoprism/. For example, to store the file in the default backup directory:
docker compose exec photoprism photoprism backup -i /photoprism/storage/backup/mysql/my_custom_dump.sql
You can also use - as the filename to write the SQL dump to stdout.
Note that our examples use the new docker compose command by default. If your server does not yet support it, you can still use docker-compose or alternatively podman-compose on Red Hat-compatible distributions.
Important Directories¶
Originals¶
The originals folder contains your original photo and video files. You can back it up and restore it using any standard file backup program if you have not already set this up.
Storage¶
SQLite, config, cache, backup, thumbnail, and sidecar files are saved in the storage folder. As with the originals folder, the exact path on your computer depends on your configuration.
We recommend backing up this folder as well so you do not need to recreate thumbnails and have a complete copy of your configuration. As with the originals folder, you can use any standard file backup utility for this.
Database¶
If you are using MariaDB or another dedicated database server instead of SQLite, they will store their data in a separate database folder whose location depends on your configuration, e.g. in the mariadb service section of your compose.yaml file.
MariaDB Server Migration¶
For detailed information on how to move your MariaDB database to another server or virtual machine, please see the Server Migration section of our MariaDB Troubleshooting Guide.