Backing Up Your LXDMosaic Instance

You should regularly back up your containers and data. This document covers backing up the LXDMosaic application itself, not the LXD instances it manages.


What Needs Backing Up

If you deployed LXDMosaic inside a container, you can snapshot or migrate that container as a backup strategy. However, the essential component to back up is:

  • MySQL / SQLite database

The database stores all of LXDMosaic's internal state, including:

  • Cloud-config templates stored in LXDMosaic
  • Historical metrics and analytics (active containers, memory usage, etc.)
  • Deployment configurations and instance mappings
  • User accounts and permissions
  • Scheduled backup and snapshot configurations
  • Software inventory and timer monitoring data

All other information (instance states, host details, profiles, etc.) is read directly from your LXD/Incus hosts on demand and does not need to be backed up separately.


How to Backup

MySQL

Create a dump of the database:

bash
mysqldump -u lxd -p LXD_Manager > BACKUP_NAME.sql

When prompted, enter the database password. You will find this value in your .env file under DB_PASS.

Important: Move BACKUP_NAME.sql to an off-site server or secure location after creating it.

SQLite (SNAP installations)

Simply copy the database file:

bash
cp /path/to/lxdMosaic.db /backup/location/lxdMosaic_backup.db

Restoring

MySQL

bash
mysql -u lxd -p LXD_Manager < BACKUP_NAME.sql

SQLite

bash
cp /backup/location/lxdMosaic_backup.db /path/to/lxdMosaic.db

After restoring, restart the relevant services to clear any stale connections:

bash
systemctl restart apache2        # or httpd on CentOS
systemctl restart lxdmosaic_node