[Dovecot] Compressing existing maildirs

Timo Sirainen
Thu, 29 Dec 2011 12:55:40 -0000

On 24.12.2011, at 17.20, Jan-Frode Myklebust wrote:

> I've just enabled zlib for our users, and am looking at how to compress
> the existing files. The routine for doing this at
> http://wiki2.dovecot.org/Plugins/Zlib seems a bit complicated. What do
> you think about simply doing:
>
> 	find /var/vmail -type f -name "*,S=*" -mtime +1 -exec gzip -S Z
-6 '{}' +
>
>
> I.e. find all maildir-files:
>
> 	- with size in the name ("*,S=*")
> 	- modified before I enabled zlib plugin

As long as it doesn't find any already compressed mails..

> 	- compress them
> 	- add the Z suffix

Make sure there's also :2, suffix already. If someone hasn't logged in
for a while there are such files in new/ directory.

> It's of course racy without the maildirlock, but are there any other
> problems with this approach ?

Other than being racy, I guess it should work.