Your mail lives on your mail servers and survives the loss of mailrust. What does not survive is everything only mailrust knows: mailbox passwords, contacts, campaigns, newsletters, calendar, settings. They are in one database, and mailrust copies it every day.
Daily copies
mailrust takes a copy of the database once a day and keeps the last seven, so you can go back up to a week. Every copy is opened and checked right after it is taken; a copy that does not open is deleted at once.
An administrator sees the copies in Settings → Database backups, can take one with Back up now and download any of them.
Copies are taken with the database's own tools while mailrust runs, so they are consistent even in the middle of a write. Copying the database file by hand is not: use the copies in backups/.
Before a schema upgrade
When a new version moves the database to a new schema, it first copies it to backups/ as premigrate-schema…-to….sqlite and keeps the last three such copies.
What to keep elsewhere
Copies in the same folder do not help if the disk fails. Take these off the server regularly:
| What | Why |
|---|---|
backups/ | Copies of the database |
master.key | Without it, mailbox passwords and other secrets in any copy cannot be read |
media/ | Images uploaded for newsletters |
/etc/mailrust/mailrust.env | Your settings |
Restore
sudo systemctl stop mailrust
cd /var/lib/mailrust
sudo -u mailrust cp backups/<copy>.sqlite mailrust.db
sudo -u mailrust rm -f mailrust.db-wal mailrust.db-shm
sudo systemctl start mailrust
Restore master.key too if the server is new. mailrust syncs mail from your servers again by itself.