Mailinabox higher frequency backup

Firstly, thankyou to Josh and the other contributors for building and maintaining mailinabox.

Has anyone set up any sort of higher frequency backup for mailinabox? I understand that the default daily backup is a reasonable tradeoff for keeping things simple, but the possibility for losing a day of mail seems like a long period.

I’m looking for:

  • consistent backup
  • small window of mail loss is ok (minutes…? an hour?)
  • NOT high availability, some downtime to switch to a backup VM is ok
  • relatively simple tweak, so not clustered filesystems or similar
  • could be unrelated to the builtin daily duplicity backup

I use lsyncd (inotify+rsync) for keeping files sync’d, but I don’t know enough about the workings of the mailserver to think this would provide a consistent backup. Would I need to pause the postfix and other services and schedule rsync instead?

Alternatively I could do something with the VM itself - I use kvm/qemu so regular live backups or snapshots could be an option.

If anyone has done something similar I would be interested to hear what works/does not work well.

Many thanks

I’ve never done anything with it, but I think this tool or similar is what you may be looking for. It might not even conflict with current MiaB configurations.

Doveadm-Sync

The simplest and hackiest way you can do this is by creating a new cronjob - let’s say, /etc/cron.d/mailinabox-backups:

The following example will run the backup script every 2 hours:

0 */2 * * *	root	(cd $(pwd) && management/backup.py 2>&1 | management/email_administrator.py "Backup Status")

You can toy with the timings here.

1 Like

Thanks for the replies

Perhaps simply increasing the builtin frequency is enough, as per what @davness suggests. I’ll do some testing on what full/incremental setup works for my use case, maybe full weekly and 2hourly incremental

Many thanks