While MAAS doesn't offer specialised backup tools, you can rely on your existing backup solutions. Know the key files and procedures to ensure both a clean backup and a smooth restoration.
Preliminaries
sudo -u postgres pg_dumpall -c > ~/dump.sql
to back up your database.sudo -u postgres psql -c "SELECT * FROM pg_stat_activity"
.Stopping services
sudo systemctl stop postgresql.service
sudo snap stop maas
Snapshot and export
sudo snap save maas
and note the snapshot ID.sudo snap check-snapshot <snapshot-id>
.sudo snap export-snapshot <snapshot-id> <external-media-path/snapshot-filename>
to save it externally.Restart and restore
sudo snap restart maas
.sudo snap remove --purge maas
.sudo -u postgres psql -f dump.sql postgres
to restore the database dump.sudo snap import-snapshot <external-media-path/snapshot-filename>
and sudo snap restore <snapshot-id>
.Preliminaries
Stopping services
sudo systemctl stop postgresql.service; sudo systemctl stop maas-dhcpd.service; sudo systemctl stop maas-rackd.service; sudo systemctl stop maas-regiond.service
.Archival
sudo tar cvpzf <some-external-path>/backup.tgz --exclude=/var/lib/maas/boot-resources /etc/maas /var/lib/maas ~/dump.sql
to archive essential files and DB dump.Restoration steps
sudo tar xvzpf backup.tgz
to extract the backup.Copy configs and restart
sudo sh -c "mv /etc/maas /etc/_maas; mv /var/lib/maas /var/lib/_maas"
.sudo sh -c "cp -prf etc/maas /etc/; cp -prf var/lib/maas /var/lib/"
.With these steps, you'll be able to backup and restore your MAAS environment effectively.