Messed up dovecot mail store, need some repair advice

Gerben Wierda gerben.wierda at rna.nl
Sat Oct 22 23:05:35 UTC 2016


> On 22 Oct 2016, at 22:09, Gerben Wierda <gerben.wierda at rna.nl> wrote:
> 
>> 
>> On 22 Oct 2016, at 19:04, Aki Tuomi <aki.tuomi at dovecot.fi> wrote:
>> 
>> 
>>> On October 22, 2016 at 7:51 PM Gerben Wierda <gerben.wierda at rna.nl> wrote:
>>> 
>>> 
>>> Hello folks,
>>> 
>>> I have an older dovecot 2.0 (which I will migrate to a 2.2 asap, but at this point in time I need a fix). This is a dovecot 2.0 that came with Mac OS X 10.8.5 Server 2.2.5.
>>> 
>>> Today, my spam/virus filtering (clamav) on the Server broke down. As a result, all my meesages got the ***UNCHECKED*** tag added to each subject. That was clearly unacceptable. SO, for the tim ebeing I have set that tag to undef so the tag is no longer added. But I also wanted to repair the messages that already ended up in dovecot 2.0
>>> 
>>> So, I did something simple: stopped all mail services on the server, went into the dovecot mail store and edited the messages. I first tried with one small ccount and it seemed OK. But now my mail client is experiencing problems with the messages (cannot display) and I think I've been to simplistic. I have for instance notedthat th esizeof the message is part of the filename. So, I can change these of course, but probably I need to change more.
>>> 
>>> Can someone enlighten me how I can repair the broken data store?
>>> 
>>> Thanks,
>>> 
>>> (Foolish) Gerben
>> 
>> I think your best bet is to delete dovecot.index* and run dovecot index -u username. Or revert all your changes. Depending what mail store you are using, this might lose any flags on your mails, such as \Read.
> 
> Thanks. Losing 300 flags and unread on thousands of emails was not a preferred scenario.
> 
> I was able to repair by 
> - turning dovecote (and other mail services) off
> - find all message files that were changed in a certain period
> - check all their names against their file sizes (this found me the edited ones)
> - returning the ***UNCHECKED*** string to the Subject lines making the file sizes equal to the size as reported in the name of the file 
> 
> Which leaves me with something I would really like: change the subject line of 5-10 messages in dovecot, without destroying everything.
> 
> I was thinking about the following scenario:
> - create a separate mailbox REPAIR within user X’s mail store (the INBOX, btw, is named ‘cur’)
> - move all to be changed messages there using the mail client
> - kill the mail client
> - stop dovecot
> - edit the messages and change the names of the files so the S= W= parts are in line with the new content. (I understand S, but what is W?)
> - run “devoid index -u user REPAIR”
> - start dovecot
> - start email client (potentially, reload the entire mail store for that user)
> 
> Would that work?

There was an easier solution. In my mail program I created a local mailbox, copied the messages there, edited them on disk, rebuilt the local mailbox and then moved them back to IMAP.

G


More information about the dovecot mailing list