Lost in transit.
You're welcome.

cyrus imapd: shared folder hierarchy recovery

Fought a half-day fight battling with our local Cyrus IMAPd installment. And talking complexity again: We’re using right this mail server implementation because it provides extensive support for shared folders and per-folder access control lists allowing for pretty fine-grained, well, control of user access to shared mail folders. ACLs indeed do add complexity to that, however, and this is what, in the end, seems to have enabled one of our internal user to move part of our IMAP folder tree to her personal Trash folder. Gone?

Fortunately not, given the Mozilla Thunderbird client involved here did just move things there and mark them as ‘deleted’ but not actually expunge them. Copying things manually out using a shell or some other file manager was pretty easy, and figuring out what (cyr)reconstruct is supposed to do also wasn’t a job that though… to overally end up with most of the folders restored but most of them empty?!

Googling around and looking deeper into things, however, quickly did resolve this issue as well: Cyrus uses to store all its stuff in /var/spool/cyrus/mail/, sorted in a more or less straightforward hierarchy. And this is where my problem finally resolved:

  • Mailbox Storage lives in /var/spool/cyrus/mail/s/Storage. So far, so good.
  • Mailbox Storage.Contacts, however, lives in /var/spool/cyrus/mail/c/Storage/Contacts… which I missed paying attention to, in this situation.
  • After having the mess moved to Trash manually, all the hierarchy was stored in /var/spool/cyrus/i/user/involvedUser/Trash/, including all subfolders. So just copying it back to its most obvious place (.../mail/s/Storage) didn’t work out as expected…

So after another examine-and-move session (copying all the folders starting with “A” from the deleted storage hierarchy to /var/spool/cyrus/mail/a/Storage/, all the “B” folders to /var/spool/cyrus/mail/b/Storage/ and so forth and finally running a cyrreconstruct -rfx Storage.*, both the hierarchy and the mail folder content seem to be back. And I am pondering a more sane mechanism of backing these things up… at the moment, without a good file manager I surely would have been doomed, so looking back at this match: Cyrus 0, gnu mc 1. Been there, done that. 🙂

16. Juli 2009

Filed under:

cyrus , mc , recovery , tech , tools