Get cyrus-imap folder size without "du" tool

Adam Tauno Williams awilliam at whitemice.org
Thu Apr 1 22:34:02 EDT 2010


On Thu, 2010-04-01 at 13:54 -0700, Andrew Morgan wrote:
> On Thu, 1 Apr 2010, Adam Tauno Williams wrote:
> 
> > On Thu, 2010-04-01 at 19:13 +0200, David Touzeau wrote:
> >> Joe Vieira wrote:
> >>> if they are all on one partition and nothing else is on that you could
> >>> just use df ....
> >>> On Thu, 2010-04-01 at 10:28 -0400, David Touzeau wrote:
> >>>> This problem occurs when you have more than 50Go mailboxes
> >>>> If you launch a "du -h -s /var/spool/cyrus/mail" the server load is on
> >>>> top and I/O is at 100% for a long time.
> >>>> Is somebody have a tips to get the size status of all maiboxes without
> >>>> using du tool even no quota is specified ?
> >> Thanks for the reply but the directory is not in a partition it is
> >> stored on the master disk with the system.
> >
> > "du" is essentially useless for Cyrus anyway since duplicate supression
> > and delayed expunge make "used disk space" kind of vague.
> >
> > If you just request the info for a mailbox it contains the mailboxes
> > size -
> >
> > sardine.mormail.com> info user.adam
> > {user.adam}:
> >  condstore: true
> >  duplicatedeliver: false
> >  lastpop:
> >  lastupdate:  1-Apr-2010 16:00:49 -0400
> >  partition: default
> >  pop3newuidl: true
> >  sharedseen: false
> >  size: 4276713
> >
> > But I can't figure out how cyradm acquires that "size" value.  Every
> > script I see walks the mailbox and accumulates the message sizes, yet
> > cyradm seems to now instantly.   Is size available via an annotation?
> 
> Those values are all annotations.  The annotation you want is:
> 
>    /vendor/cmu/cyrus-imapd/size

I suspected as much but haven't had much luck getting a value.

import imaplib
m = imaplib.IMAP4('imap.mormail.com')
m.login(***********************)
m.getannotation('user.adam', '"/vendor/cmu/cyrus-imapd/size"', '"*"')
---- ('OK', [None])
m.getannotation('user.adam', '"/vendor/cmu/cyrus-imapd/size"',
'"value.shared"')
----('OK', [None])
m.getannotation('user.adam', '/vendor/cmu/cyrus-imapd/size',
'"value.shared"')
-----('OK', [None])
m.getannotation('user.adam', '/vendor/cmu/cyrus-imapd/size',
'("value.shared")')
----('OK', [None])
m.getannotation('user.adam', '/vendor/cmu/cyrus-imapd/size', '("
value.shared")')
----('OK', [None])

Nothing produces a value.  Any pointers?  There seems to be basically
zero documentation about IMAP annotations.



More information about the Info-cyrus mailing list