Backup procedures

Bernardo Reino reinob at bbmk.org
Sun Feb 13 17:25:29 UTC 2022


On Sat, 12 Feb 2022, Stephane Magnier wrote:

> I've just tried
>
> doveadm backup /var/spool2/mail/user1 /home/backup/
>
> doveadm(user1): *Error: Index is read-only*, can't write-lock 
> /var/spool2/mail/user1/dovecot.list.index.log
> doveadm(user1): Fatal: execvp(/var/spool2/mail/user1) failed: Permission 
> denied
> dsync-local(user1)<RYx1OMIeCGLn3AMATqx/tA>: Error: read(remote) failed: EOF 
> (version not received)
>
> even this, with a chmod 777 on the all folder ( /var/spool2/mail/user1 before 
> :-(   )

The way I use it is
# doveadm backup -u $MAILBOX mdbox:/path/to/backup/$MAILBOX/mdbox

where MAILBOX=user at domain (or just user, depending on how you've setup dovecot).
(note, I use mdbox, both for "live" dovecot and for the backup).

I don't think the way you're using it works, because the argument to doveadm 
backup is the user and not the physical path where the mailbox is stored.

For completeness, my full script (run via cron.weekly) is:
--<<--
USERS=$(cut -d: -f1 /etc/dovecot/virtual_passwd)

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
-->>--

The backup is then at /srv/snap_mail, which I can rsync wherever I want to..

Cheers,
Bernardo


More information about the dovecot mailing list