Hello,
I'm curious as to what happens if I were to manually delete files in an sdbox on the server. A long time ago -- I'm not sure how, as it was several years ago -- something happened and a number of users got a large number of mail messages duplicated. Literally duplicated -- all headers, all body content.
I have a script that can find these duplicated messages (by ignoring the first few and last few lines of each message, and using SHAs to compare and find the duplicates). However, I don't see a doveadm style command to manually delete messages, except for doveadm-expunge. In the past I've used that with search queries but my experience is that trying to do many individual operations on individual files with doveadm-expunge can be quite slow.
So, if Dovecot is going to just say "huh, my indexes/metadata are wrong, lemme rebuild them", I'd rather just rm the messages and let Dovecot do its thing. Again, this is with sdbox storage. Dovecot version is 2.2.9.
Thanks! --Jeff
Zitat von Jeff Mitchell jeffrey.mitchell@gmail.com:
I have a script that can find these duplicated messages (by ignoring the first few and last few lines of each message, and using SHAs to compare and find the duplicates). However, I don't see a doveadm style command to manually delete messages, except for doveadm-expunge. In
Well...
doveadm is an abstraction layer to the user. It doesn't care that you
want to delete file x or y, it does care that you want to delete that
one specific mail and locates it for you and deletes it then. That's
being done on purpose.
And deleting mails with doveadm needs to operations:
- you need to mark the mail for deletion, means you need to expunge it, then
- you need to purge it.
Purging all your mailboxes should be done in a maybe daily run cron job.
And how to construct a dovecot search query is documented here:
http://wiki2.dovecot.org/Tools/Doveadm/SearchQuery
You could use the message UID to delete those pesky messages maybe.
Of course you could try deleting those messages on your own and run
afterwards a doveadm index. This should also do the job.
On Dec 27, 2014 3:19 AM, "Marc Stürmer" mail@marc-stuermer.de wrote:
You could use the message UID to delete those pesky messages maybe.
Of course you could try deleting those messages on your own and run afterwards a doveadm index. This should also do the job.
As I said in my OP I could use doveadm-expunge with a search query. But I've done that and it's very slow to rerun constantly with various UIDs. I could maybe write a query with thousands of UIDs if it wouldn't complain.
My actual question as stated was what happens if I just rm those files... if Dovecot will be okay with it, figure out that the mailboxes don't match, and fix the index and cache files. If rerunning doveadm-index after manually will make everything happy, this seems like the faster approach. But I just want to make sure I won't damage the sdbox in a permanent sense.
Thanks, Jeff
On 27 Dec 2014, at 10:18, Jeff Mitchell jeffrey.mitchell@gmail.com wrote:
On Dec 27, 2014 3:19 AM, "Marc Stürmer" mail@marc-stuermer.de wrote:
You could use the message UID to delete those pesky messages maybe.
Of course you could try deleting those messages on your own and run afterwards a doveadm index. This should also do the job.
As I said in my OP I could use doveadm-expunge with a search query. But I've done that and it's very slow to rerun constantly with various UIDs. I could maybe write a query with thousands of UIDs if it wouldn't complain.
I'd think you should be able to run doveadm expunge -u user@domain mailbox foo uid 5,10,100,101,102,etc.
That shouldn't be much slower than rm'ing them.
My actual question as stated was what happens if I just rm those files... if Dovecot will be okay with it, figure out that the mailboxes don't match, and fix the index and cache files. If rerunning doveadm-index after manually will make everything happy, this seems like the faster approach. But I just want to make sure I won't damage the sdbox in a permanent sense.
doveadm force-resync fixes it, but it's a bit ugly way.
How about using doveadm deduplicate command instead?
participants (3)
-
Jeff Mitchell
-
Marc Stürmer
-
Timo Sirainen