[Dovecot] Backup Maildir

Geo Carncross geocar-dovecot at internetconnection.net
Mon Oct 17 17:12:14 EEST 2005


On Sun, 2005-10-16 at 18:20 +0300, Timo Sirainen wrote:
> On Thu, 2005-10-06 at 17:09 -0400, Geo Carncross wrote:
> 
> > 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)
> 
> Using rename() to overwrite mboxes has two problems:

Agreed, but the problems with not using rename() are also critical:

> 1) Uses more disk space so people with filesystem quota wouldn't be able
> to expunge messages.

1) Cannot safely take a backup since the mbox is never in a safe state

Because there's never a safe state, people _lose_data_. Arranging for
quotas to be rescinded while expunging, or making the dovecot/mta
combination aware of the quota and lock delivery (see #2) when 1/2 full,
solves this problem.

Using an agent that can be immune to quotas that performs the expunge
might also be preferable to losing data.


> 2) A lot of mbox software don't notice the new mbox file, so they keep
> reading/writing to the old mbox file and that could lose changes.
> Dovecot checks this though.

2) No locking mechanism is used that can keep the mbox in a safe state
long enough to take a snapshot.

These really are different problems caused by the same root: There needs
to be a way to "stop delivery" temporarily, as well as stop breaking the
mbox file.

With qmail, one can +t the home directory to halt delivery. dovecot-lda
should have a similar mechanism, and other MTAs/MDAs should be providing
something similar.


> Anyway, because of these Dovecot doesn't do the rename()-expunging for
> mboxes.

With "2" alone, the mbox could be held in a safe state long enough to
take a backup. It would require wiring up the backup software somewhat,
but at least it's possible.

If the mbox is always kept in a safe state (!) then existing backup
software could be used. I suppose the question is which is easier for
administrators to shoehorn the right semantics for their systems: adding
some complexity to the backup software, or adding some complexity to the
mail delivery process [something that is probably very complicated
already :)]

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



More information about the dovecot mailing list