2

I maintain an IMAP server running Dovecot which uses Maildir as the storage format for the user mailboxes. Every night, an rsync process runs to create a backup of the mailboxes. Recently, I noticed that rsync occasionally prints messages like

file has vanished: "/home/vmail/lists/archive/Maildir/.sales/dovecot-uidlist.lock" rsync warning: some files vanished before they could be transferred (code 24) at main.c(1655) [generator=3.1.1]

My understanding based on the Locking section in the Dovecot wiki is that this lock file is a custom extension of Dovecot which is held while the dovecot-uidlist file is being written to. Hence, if a file is being delivered while the backup is running, it may happen that the .lock file gets removed during the backup - triggering above warning message.

It would be easy to exclude this lock file from the backup, but I wonder: should we maybe rather lock the mailbox (such that no modifications to it take place) during the rsync backup? If so, how can one do this using Dovecot?

Frerich Raabe
  • 801
  • 7
  • 15
  • By accident, I found that the Dovecot [Zlib wiki page](https://wiki.dovecot.org/Plugins/Zlib) mentions a utility called `maildirlock`. Indeed, an [older mail on the dovcot list](https://www.dovecot.org/pipermail/dovecot/2011-September/078593.html) mentions the same utility. I suspect that might be useful... – Frerich Raabe Apr 18 '18 at 08:23
  • Consider elaborating this a little as a self answer. :) – Esa Jokinen Apr 18 '18 at 14:00
  • 1
    Possible duplicate of [Make consistent copy of maildir](https://serverfault.com/questions/758450/make-consistent-copy-of-maildir) – derobert Apr 23 '18 at 21:04
  • The way I do it for one-offs is to use doveadm to make a maildir+ format copy of the mailbox, then back up that. But this is probably not a good way if you need to do bulk backups regularly. – Steve Shipway Apr 25 '19 at 01:16

0 Answers0