[Dovecot] Backup Maildir

Geo Carncross geocar-dovecot at internetconnection.net
Fri Oct 7 00:09:06 EEST 2005


On Thu, 2005-10-06 at 23:54 +0300, Odhiambo Washington wrote:
> * On 06/10/05 13:10 -0400, Geo Carncross wrote:
> > On Thu, 2005-10-06 at 19:10 +0300, Odhiambo Washington wrote:
> > > * On 06/10/05 16:06 +0100, Gabe Granger wrote:
> > > > Hi All,
> > > > 
> > > > I'm currently doing nightly full backups of /home.  I'm not sure if a  
> > > > full back up is the best way to do backups.  I know with my  
> > > > fileserver i do weekly full backup and daily incremental which would  
> > > > file on those type of files.  I guess my question to the group is,  
> > > > how do you guys backup Maildir? whats the best way of doing it?
> > > 
> > > 
> > > This is an interesting question, especially because it relates to mail!
> > > I am a systems admin, but this is one area that I seriously flop in.
> > > 
> > > How do you backup e-mails for users when during the backup, they are
> > > deleting the e-mails from the Maildir (POPping) and at the same, and
> > > the SMTP server is also writing to it. This is very real on a busy
> > > mail server.
> > > 
> > > So, how do people make backups of client's e-mails (Maildir)???
> > 
> > The ostrich approach works very well for Maildir. Deleting entries or
> > new entries either show up or they didn't.
> 
> Please describe this ostrich approach, or show me how.
> We only know of Ostriches for meat these sides :-)

Ignore the problem. It's a non-problem.

Maildirs can be accessed atomically. The data that dovecot
uses/generates that can't be is regenerated by dovecot (or should be)
when it needs to be.

Do what an ostrich does and insert head into ground.

If that means clients have to download extra messages, its the least of
your worries after a restore.

Nevertheless: since many messages will show up "at least once" (being
incremental), this could cause many people problems. Similarly, using
mbox, your chances are getting a reasonable "snapshot" of your mailbox,
or getting nothing at all.

Backing up mailboxes is like backing up a mail queue. The only way for
the backup to really be useful is if you can stop the queue (or the
mailbox). But failures that require backups are so infrequent, that is
it really worth putting your disk through all that extra work, and
slowing down delivery time by so much to get a backup that might not
ever be needed?

If you really wanted real backups of something as volatile as a mailbox
or a mail queue, you'd use a logging filesystem and replicate your log.

I make naive backups of maildirs, because it's close enough for most
things. Any closer than what I get out of the naive approach (and
ignoring the problem) slows things down so much that mail becomes
useless.

Mbox on the other hand is much easier. Just make sure your backup
software locks the mbox before taking a snapshot and make certain your
expunge operations NEVER update the mbox file in place (but instead
rename() etc)

-- 
Internet Connection High Quality Web Hosting
http://www.internetconnection.net/



More information about the dovecot mailing list