On 10/18/2022 7:46 PM, Steve Litt wrote:
On Tue, 2022-10-18 at 16:48 +0200, Bernardo Reino wrote:
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
Do you think the preceding shellscript will work if I store my Dovecot messages in
the Maildir form?

Thanks,

SteveT 

Yes it will. The source format is your current format (maildir) and the target format is whatever you specify (mdbox:  or maildir:)

I do something similar with my daily backups using dsync. Like others, I was hesitant about using mdbox in the beginning and my solution was to create my point in time backups in maildir format.
for user in $users; do
    dsync -u ${user} backup maildir:/home/$user/.mailbkup/mailboxes
done

This is a simplified version of my command. In my backup script this runs inside another loop to make backups for all users in parallel, but I only have about 20 users and plenty of excess CPU on my server.
I run this about 4 times per day to sync changes to my backup copy. Once the initial sync is done the incremental changes run pretty quickly.

Doug