On Thursday 31 March 2005 17:27, Andreas Aardal Hanssen wrote:
> the files are stored in LF/Unix style in Maildir (why, oh why?)
Because that's the way things should be. Thank the stars qmail does it this
way, instead of doing things arsewards for your convenience.
> so calculating the size requires the file to be read and converted to CRLF,
> which is what IMAP requires.
What does maildirsize have to do with IMAP? Certainly this strange converted
size has nothing to do with actual disk usage, which is what matters.
> The storing of the size in the file name does break a do-not in the
> (somewhat loose) Maildir spec
Yes, I don't particularly like it, but that's the way it is I guess.
> but the I/O load impact is the biggest problem... Opening a mailbox with
> 5000 messages, calculating the size of each message, renders an average mail
> server useless because of the immense I/O load.
What's wrong with a simple `du` on the maildir?
> maildirsize is documented to be inaccurate.
This is why I don't use it. I thought at first it was useful, but then I
realized that it was useful and terribly inaccurate in vpopmail, so now no
quotas are set. I find a much better solution is to periodically check the
size of maildirs on the system and then send a warning to the user. I don't
want mails to be rejected just because a mailbox is full anyways (this could
piss a client off) - I'd rather just warn them or charge them for a bigger
mailbox (then everyone's happy).
> > I'm not sure if there is some special advantage to the message size in
> > the filename, but all I care about at the moment is making sure
> > maildirsize is properly updated when users access their mailboxes via
> > imap. I suppose I could write some sort of wrapper program to recalc the
> > maildirsize every x hours, but that, I believe, would be overkill...
>
> Yes, that'll be a killer. Here's a place where mbox makes life easier -
> the mailbox quota check is simply a stat.
I don't think it would be overkill. But I do think that quota for mail is
evil. Why not rely on filesystem quota (I don't use it so I can't vouch for
it).
Here's a little script you can throw into a daily cron to report disk usage.
You can easily edit it to fit your setup (mine involves using vpopmail with a
Maildir --> .maildir patch):
vmailroot=/var/vpopmail/domains
for domain in `find "${vmailroot}" -type d -maxdepth 1 -mindepth 1 | cut -d
'/' -f 5`; do
echo ${domain}
for user in `find "${vmailroot}/${domain}/" -type d -maxdepth 1
-mindepth 1 | cut -d '/' -f 6`; do
if [ -f
maildir="${vmailroot}/${domain}/${user}/.maildir"
maildirsize=`du -h --max-depth=0 ${maildir}/ | cut -f 1`
echo " - [EMAIL PROTECTED] - ${maildirsize}"
done
done
Cheers,
--
Casey Allen Shobe | SeattleServer, Inc.
[EMAIL PROTECTED] | cell 425-443-4653
http://www.seattleserver.com
Please send any responses to [EMAIL PROTECTED]