mdbox vs. maildir format

Bernardo Reino reinob at bbmk.org
Tue Oct 18 14:48:44 UTC 2022


On 18/10/2022 12:17, Michael wrote:
 >
 > [...]
> so, raid is mandatory, which is already the case, but what about backup? 
> how can i achieve a backup/snapshot of both, the mdbox (nfs share) and 
> the index files (local raid) and assure they are consistent?

You can use doveadm to backup the mailboxes, which should work correctly 
even in a live system.

My backup "strategy" (hopefully it deserves that name) is to weekly run 
something like:

for MAILBOX in $USERS; do
         doveadm expunge -u "$MAILBOX" mailbox Trash savedbefore 7d
         doveadm expunge -u "$MAILBOX" mailbox Spam savedbefore 30d
         doveadm purge -u "$MAILBOX"

         LOCATION2="mdbox:/srv/snap_mail/$MAILBOX/mdbox"
         doveadm -v backup -u "$MAILBOX" -P "$LOCATION2"
done

which makes a replica of the mailbox (including dovecot.list.index, but 
e.g. dovecot-uidvalidity is not there, I don't know if this is bad or not).

Once you have this "snapshot" of the mailbox(es), you can rsync them to 
wherever you like (so you avoid rsync'ing a changing system).

I've never had to restore from backup (rsync back, and either doveadm 
backup back in the other direction), but I'd tend to assume this should 
work fine.

BTW I use mdbox_rotate_interval = 0 and mdbox_rotate_size = 64M, so the 
mdbox'es have a relatively big size (but not too big), which is nice for 
rsync.

Cheers,
Bernardo


More information about the dovecot mailing list