How to backup maildir

Christoph Haas christoph+dovecot at
Sun Feb 10 09:24:27 EET 2019

Hello Robert,

----- Nachricht von Robert Moskowitz via dovecot <dovecot at>  
      Datum: Sat, 9 Feb 2019 22:50:24 -0500
        Von: Robert Moskowitz via dovecot <dovecot at>
Antwort an: Robert Moskowitz <rgm at>, Dovecot Mailing  
List <dovecot at>
    Betreff: How to backup maildir
         An: Dovecot Mailing List <dovecot at>

> I have been thinking, and reading, on how to back up my mailserver.  
> I have not found any approach that seems ready to use.
> I have run years without any backup, but would really like to have  
> something in place.

you're a really lucky guy! - I've been struck in the past for such  
carelessness on the one or other machine with dataloss ;-)

>   I figure I can attach a USB drive and backup to that, then from  
> there rsync to something elsewhere.  Further if that USB drive is a  
> full mailserver image, I actually have a 'hot backup' where I only  
> have to put the backup drive into a system and boot up at the last  
> backup.
> But this means properly copying all of /home/vmail and probably  
> /home/sieve plus the /var/lib/mysql

Are you aware of the dovecot command "dsync"? (man dsync or
This could be an approach of using dsync:
dsync backup -o plugin/quota= -f -u $user backup  

> Are there good tools that nicely does this?  Or do I choose a time  
> late at night (only I am sometimes in non-US timezones) to shut down  
> all services and just use rsync?
> And stopping services itself is thought provoking.  What if Dovecot,  
> amavis, mysql, or whatelse is in the middle of writing out a mail  
> file what happens to that file and restart.
> Just scary stuff and, in part, why I have never tackled this in the past.
> thanks for all feedback

----- Ende der Nachricht von Robert Moskowitz via dovecot  
<dovecot at> -----

It really depends on how important your data is to you ... But you  
should really think about a general backup-strategy!
"Mr. Google" can help you to get some ideas how YOUR backup-strategy  
could look like...
Also there is much input for backing up dovecot with it's different  
mail storage flavours.
- But you have to invest some effort on your own, to search, read,  
evaluate and finally choose what's fitting into YOUR setup!

But as an starting point:
I'm using a for _MY setup_ modified and adopted version of Klaus  
Tachtler's dovecot-backup script:

... mixed it with Borg Backup:

... some further encryption, cloud storage and ... and ... and other stuff.

But as above mentioned:
YOU have to think about the grade of your paranoia level, how  
importand the data is to you in case of an data loss, time and money  
you are willing to invest and build upon this YOUR PERSONAL backup  
- Sadly there is no one-size-fits-all!

Last famous words:
I've looked at your vita and was wondering about your post - you were  
writing RFCs, but have no clue about backing up your mail-data???  
Strange ...

Nevermind! Just my 2ct - hope this helps

Christoph Haas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-keys
Size: 3178 bytes
Desc: ?ffentlicher PGP-Schl?ssel
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 821 bytes
Desc: Digitale PGP-Signatur
URL: <>

More information about the dovecot mailing list