GLPI Backup and Disaster Recovery: The Definitive Guide

Complete script for automated GLPI backup (database + files), backup rotation, restore testing and disaster recovery plan.

A backup that has never been tested is hope, not strategy. This guide covers automated backup, rotation and restore testing for GLPI.

What to back up

  • Database: all GLPI data (tickets, assets, users, settings)
  • Files: uploads, documents, plugins, logos and custom settings
  • Configuration: GLPI and server configuration files (Apache/Nginx, PHP)

Automated backup script

#!/bin/bash
BACKUP_DIR="/backup/glpi/$(date +%Y-%m-%d)"
mkdir -p "$BACKUP_DIR"

# Database
mysqldump -u glpi -pSENHA --single-transaction glpi | gzip > "$BACKUP_DIR/glpi_db.sql.gz"

# Files
tar -czf "$BACKUP_DIR/glpi_files.tar.gz" /var/lib/glpi /etc/glpi

# Rotation: keep last 30 days
find /backup/glpi -maxdepth 1 -mtime +30 -exec rm -rf {} \;

echo "Backup completed: $BACKUP_DIR"

Schedule with cron: 0 2 * * * /opt/scripts/backup-glpi.sh

Backup with Docker

# Database
docker exec glpi-db mysqldump -u glpi -pSENHA glpi | gzip > /backup/glpi_db.sql.gz

# Volumes
tar -czf /backup/glpi_volumes.tar.gz /opt/glpi/data /opt/glpi/config

Restore test

  1. Bring up a test environment (Docker is ideal)
  2. Restore the database: gunzip < glpi_db.sql.gz | mysql -u root glpi_test
  3. Restore the files to the corresponding directories
  4. Access the test GLPI and check: login, tickets, assets, plugins

Disaster Recovery

  • RPO (Recovery Point Objective): how much data loss is acceptable? (defines backup frequency)
  • RTO (Recovery Time Objective): how long to restore? (defines where and how to store backups)
  • Keep an offsite copy (another server, cloud storage)
  • Document the restore procedure step by step

Frequently Asked Questions

Database backup (mysqldump) + backup of data directories (/var/lib/glpi), configuration (/etc/glpi) and plugins. Automate with cron and 30-day rotation.

Database: daily. Files: weekly (they change less). Incremental backups during the day if ticket volume is high.

Restore periodically to a test environment. A backup that has never been tested is as bad as no backup. Schedule quarterly tests.

Yes. Back up Docker volumes with docker cp or rsync of the mounted directories. The database needs a consistent mysqldump.

Need help?