Howdy,
I have a particular situation where I have about 5 users using a large account in IMAP, and I have the need to backup the account daily or weekly or so. I was thinking about to copy the whole directory, each email is a file, it could probably work, but the dovecot index files would be damaged/wrong.
Is there a tool that could perform a backup (ex: yesterday), and when I inserted that backup, it just insert the emails and folders that were deleted today?
Thanks in advanced, Jorge
On 2022-02-11 12:33, Jorge Bastos wrote:
Howdy,
I have a particular situation where I have about 5 users using a large account in IMAP, and I have the need to backup the account daily or weekly or so. I was thinking about to copy the whole directory, each email is a file, it could probably work, but the dovecot index files would be damaged/wrong.
Is there a tool that could perform a backup (ex: yesterday), and when I inserted that backup, it just insert the emails and folders that were deleted today?
linux: imapsync windows: google aid4mail dovecot: ask help with better wiki for dovecot on replications, but even if this works its not backup, delete one msg deletes backup, hmm, chicken and egg here
Hi Benny,
Well, it's that, the chicken and the egg history! Not everything's possible, but end users think we do magic.
Thanks for the help,
On 2022-02-11 16:36, Benny Pedersen wrote:
On 2022-02-11 12:33, Jorge Bastos wrote:
Howdy,
I have a particular situation where I have about 5 users using a large account in IMAP, and I have the need to backup the account daily or weekly or so. I was thinking about to copy the whole directory, each email is a file, it could probably work, but the dovecot index files would be damaged/wrong.
Is there a tool that could perform a backup (ex: yesterday), and when I inserted that backup, it just insert the emails and folders that were deleted today?
linux: imapsync windows: google aid4mail dovecot: ask help with better wiki for dovecot on replications, but even if this works its not backup, delete one msg deletes backup, hmm, chicken and egg here
Why not doing an rsync of the folders ? Will it damage the index file ?
On 2/11/22 12:33, Jorge Bastos wrote:
Howdy,
I have a particular situation where I have about 5 users using a large account in IMAP, and I have the need to backup the account daily or weekly or so. I was thinking about to copy the whole directory, each email is a file, it could probably work, but the dovecot index files would be damaged/wrong.
Is there a tool that could perform a backup (ex: yesterday), and when I inserted that backup, it just insert the emails and folders that were deleted today?
Thanks in advanced, Jorge
OK , so I can see that there is this doveadm backup..
I don't use any MailDir on each account.. but all the emails are stored into the folder /var/www/mail ( user 1 , user2, etc... )
in that case, a very basic backup would be : *doveadm backup /var/www/mail /var/backup/folder* ?
( I prefer to ask before trying, because If break something.. here, they will kill me :-( )
On 2/11/22 17:55, Stephane Magnier wrote:
Why not doing an rsync of the folders ? Will it damage the index file ?
On 2/11/22 12:33, Jorge Bastos wrote:
Howdy,
I have a particular situation where I have about 5 users using a large account in IMAP, and I have the need to backup the account daily or weekly or so. I was thinking about to copy the whole directory, each email is a file, it could probably work, but the dovecot index files would be damaged/wrong.
Is there a tool that could perform a backup (ex: yesterday), and when I inserted that backup, it just insert the emails and folders that were deleted today?
Thanks in advanced, Jorge
On Fri, 11 Feb 2022, Stephane Magnier wrote:
OK , so I can see that there is this doveadm backup..
I don't use any MailDir on each account.. but all the emails are stored into the folder /var/www/mail ( user 1 , user2, etc... )
in that case, a very basic backup would be : *doveadm backup /var/www/mail /var/backup/folder* ?
I use doveadm backup like that and then rsync the backup (not the "live" mailboxes) to another place.
( I prefer to ask before trying, because If break something.. here, they will kill me :-( )
It's understandable :)
Cheers, Bernardo
Hi,
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)
even this, with a chmod 777 on the all folder ( /var/spool2/mail/user1 before :-( )
What is the trick ? :-)
What did I miss out ?
Thanks for your help
On 2/12/22 15:44, Bernardo Reino wrote:
On Fri, 11 Feb 2022, Stephane Magnier wrote:
OK , so I can see that there is this doveadm backup..
I don't use any MailDir on each account.. but all the emails are stored into the folder /var/www/mail ( user 1 , user2, etc... )
in that case, a very basic backup would be : *doveadm backup /var/www/mail /var/backup/folder* ?
I use doveadm backup like that and then rsync the backup (not the "live" mailboxes) to another place.
( I prefer to ask before trying, because If break something.. here, they will kill me :-( )
It's understandable :)
Cheers, Bernardo
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)
: 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@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
I've had some success with restic to create incremental backups of mail directories on external storage. Very space efficient, and restic will handle all the de-duplication, pruning etc.
You could write a filter to exclude the dovecot index files, or just restore to a different directory before copying the mails you want back to their destination.
P.
On 12/02/2022 00.55, Stephane Magnier wrote:
Why not doing an rsync of the folders ? Will it damage the index file ?
On 2/11/22 12:33, Jorge Bastos wrote:
Howdy,
I have a particular situation where I have about 5 users using a large account in IMAP, and I have the need to backup the account daily or weekly or so. I was thinking about to copy the whole directory, each email is a file, it could probably work, but the dovecot index files would be damaged/wrong.
Is there a tool that could perform a backup (ex: yesterday), and when I inserted that backup, it just insert the emails and folders that were deleted today?
Thanks in advanced, Jorge
.
participants (5)
-
Benny Pedersen
-
Bernardo Reino
-
Jorge Bastos
-
Plutocrat
-
Stephane Magnier