Reconstructing mailboxes when using delayed expunge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

we're running Cyrus 2.3.11 with "delete_mode: delayed". Today, for the first time since using that feature, we had to undelete an entire hierarchy of mailboxes a user had inadvertently deleted. We found that it was more tricky than we had anticipated. This is an anecdotal report of how we managed to do it eventually. I hope this might help other admins in the future, because I don't think this is really documented anywhere.

The first issue was finding the deleted mailboxes. It seems they can be anywhere, more or less. We have three partitions. We managed to find them by doing this:

ctl_mboxlist -d | grep DELETED | grep username

Then we had to look for them with mbpath, replacing the '.' with '/', because we use unixhierarchysep. The next surprise was that the actual mails were in subdirectories with funny names, e.g.:

DELETED/user/xxx/blabla/bla/48873884

(That's when the original mailbox was called user/xxx/blabla/bla)

I found out that a timestamp is added by reading the source. I suppose that's so that multiple deletions of a mailbox of the same name don't clobber prior versions.

We then copied the contents of the timestamped folders to a newly created folder in the user's mailbox. Our internal documentation said not to copy the metadata (i.e. the cyrus.xxx files), but I don't remember why. Is that the right thing to do? It caused us some headaches later on.

Then we tried our usual reconstruct approach, i.e. 'reconstruct -rf user/xxx'. However, the restored mailboxes weren't added. The reason is that -f only works when a cyrus.header file exists. Then we tried touching cyrus.header in the folders. But that's no good in itself, either. There was an error message that the mailbox had an invalid format. A look at the manpage suggested that -x should help. That sort of worked, but two mailboxes still weren't added because there was no cyrus.header file.

So without the trial & error, the correct approach seems to be:

- find the mailbox(es)
- copy their contents (with or without metadata)
- touch cyrus.header in *all* mailboxes if you did not copy the metadata
- run 'reconstruct -rfx' on the user

Has anybody else found a better way? Does everybody agree that there should be an 'unexpunge' for mailboxes as well?? I guess an unexpunge for mailboxes would have to let you specify a target folder, because simply writing everything to the original position might not be correct ...

Cheers, Sebastian Hagedorn
--
    .:.Sebastian Hagedorn - RZKR-R1 (Gebäude 52), Zimmer 18.:.
Zentrum für angewandte Informatik - Universitätsweiter Service RRZK
.:.Universität zu Köln / Cologne University - ✆ +49-221-478-5587.:.
                  .:.:.:.Skype: shagedorn.:.:.:.

Attachment: pgpUnx0qhzoqU.pgp
Description: PGP signature

----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux