User:Imz/research on HOW TO backup an IMAP account

From ALT Linux Wiki
< User:Imz
Revision as of 05:55, 11 November 2009 by Imz (talk | contribs) (a part of what I have found out; to be continued)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

(Better and worse ways to backup an IMAP account; a research of the available options.)

I want to maintain a backup of an "IMAP account" (I mean the collection of mailboxes/folders accessed via IMAP by a single user on a remote server), with history.

So I'm assessing the variants of doing this, choosing the optimal combination of individual decisions (regarding the subtasks of this greater task) and tools.

Subtasks and goals/desirable requirements

Tracking the history

I want to be able to revert to a certain state of the mailboxes in the past, or to inspect the past states, because I do not want to hold the trust that no valuable message gets accidentally deleted.

-- I'll probably use git to store the historical changes since it's a familiar (for me) and robust tool.

The format for storing the mailboxes

And for git to handle and show the history in the most sensible way, it's very desirable to use a format which uses one file per one message.

-- Maildir is such well-known format. Moreover[???], each message is not allowed to change its content in IMAP or Maildir: meta-information is stored in the filenames -- this will make the history tracking (the git way) especially lucid.

Contra: Maildir might not be supported by all the software, for example, its support is brought into the "c-client" library only by a patch[???].

Alternatives:

  • the non-"1 file per 1 msg" formats (mbox, etc.) -- not desirable;
  • the [??? mix] format, but although it can use multiple files per mailbox, it groups several messages into one file [1], which is not nice for tracking the history in the most lucid way with git.

Transferring the mailboxes from the IMAP server

Tools that could do that:

  • ...
  • movemail from mailutils (present in Sisyphus!)
  • mailutil from uw-imap/pine/alpine (present in Sisyphus!)
  • imapsync (present in Sisyphus!)
  • offlineimap (present in Sisyphus!)
  • ...
  • fetchmail (present in Sisyphus!)
  • ...
  • isync (not present in Sisyphus!)
  • mailsync (not present in Sisyphus!)
  • ....

Partial transfers (only updates) of the mailboxes

...
movemail
(no)
mailutil transfer
(no)
imapsync
(yes)
offlineimap
(yes)
...

Transferring the whole account (many folders with one command)

...
movemail
(no)
mailutil transfer
yes
imapsync
(?)
offlineimap
(?)
...

Saving keywords, flags

???

Making the new server to serve the old keywords

uw-imap
(???)
dovecot
uses a certain means to strore the extra keywords in Maildirs[2][3], so if one has saved them, one could prepare them for dovecot.

Saving UIDs (to seamlessly switch to a backup IMAP server)

???

Making the new server to serve the old UIDs

uw-imap
the Maildir patch (by Chappa) won't do this, because it doesn't at all try to preserve the UIDs between sessions, it doesn't store them [???]
dovecot
has a certain method to store UIDs [4][5]; so if one has the UIDs, one can translate the list of the UIDs into the format used by dovecot.
courier-imap
also stores the UIDs in a special own file[6][7], similarly to doevcot (but with formal differences).
uw-imap with another Maildir patch[8]
handles UIDs, stores them in the filename before the flags (extends the Maildir standard format), so in principle could be also a solution if I want a server to serve the backup copy.
uw-imap with yet another Maildir patch[9]
also stores the UIDs in the filenames, but I guess differently from the previous patch, and the author considers switching to a format compatibe with courier-imap.

Restoring the content on the primary IMAP server

It must be impossible with preservation of UIDs if the access is only through IMAP, but otherwise one can--of course--use the following tools for this task: ...

Conclusion

???