Hi,

I am using vpopmail-5.2.1, courier-imap-2.0, qmail-1.03. I use both courier-
imapd and courier-pop3d instead of qmail-pop3d.

A few days after I migrated my users from an old mail server to my new nfs 
server, users started getting weird quota reulsts on the webmail quota.
vuserinfo reported 0% for the usage although du -sh on the user's maildir 
reported about 3-4 megs. Looking at maildirsize, there was many lines with 
negative values.
telnetting to the imapserver 143, logging in as the user, and issuing "a001 
getquota ROOT" I get also negative USAGE value.

While googling for something related to this problem, I found only one post:
http://www.geocrawler.com/archives/3/3723/2002/2/350/7883526/

Mr Sam said:
-----------------
This can happen if mail gets delivered to a mailbox by a delivery agent that 
does not update the quota tracker. 
Solution: use deliverquota or maildrop to deliver mail, and make sure that 
the quota is correctly specified.
-----------------

This is not the problem for me however. The only programs that deliver to 
maildirs are vdelivermail, maildrop (both compiled with maildirquota support), 
and qmail-local. I know qmail-local doesn't support maildirquota++ but this 
never was a problem, and I confimed it's not the one causing the problem (read 
below).

So looking at the maildirsize file in the maildirs of users having the 
problem, they all had negative values. So I wrote a little shell script (see 
at the end of this message) that finds those mailboxes with bad maildirsize 
files, deletes them, runs /home/vpopmail/bin/vuserinfo -Q [EMAIL PROTECTED] on 
the accounts for which the maildirsize was deleted to recreate it, and then 
sets the proper permission (uid/gid vpopmail/vchkpw).

This solved the problem. Sending mail from local domain to another local 
domain, or from a remote domain to a local domain both seem to reflect the 
_correct_ size now, and instantaneously.
Therefore it's not qmail-local?

I am suspecting it could be that the file sizes changed slightly when moved 
over to the nfs server on a ext3 partition with a 4096 blocksize. The 
filesystem on the old mailserver was ext2 and default blocksize (redhat 6.2).

Could this possibly confuse courier-imap and cause it to put negatives in 
maildirsize? or is it vdelivermail that was confused?

Any thoughts, ideas?

Best Regards,
Tim Hasson


Here is the script I used to fix the maildirsize files:
--------------------------------------------------------

#!/bin/sh

echo "[*] Finding maildirsize files..."
sizes="`find domains -name maildirsize`"

echo "[*] Finding bad maildirsize files and saving them in badmaildirsize.tmp"

rm badmaildirsize.tmp

for i in $sizes; do
   if [ ! -z "`grep "-" $i | head -1`" ]; then
      echo $i >> badmaildirsize.tmp
   fi
done

echo "[*] Creating [EMAIL PROTECTED] list for whom we recreate maildirsize"

rm mailboxdir.tmp

# get "domain.com/user" from domain/domain.com/user/Maildir/maildirsize
   sed s/domains.//g badmaildirsize.tmp | \
     sed s/.Maildir.maildirsize//g > mailboxdir.tmp

rm fixemail.tmp

#  change domain.com/user to [EMAIL PROTECTED]
mailboxlist="`cat mailboxdir.tmp`"
for mailbox in $mailboxlist; do
   username="`echo $mailbox | sed s#.*/##`"
   domainname="`echo $mailbox | sed s#/.*##`"
   echo "[EMAIL PROTECTED]" >> fixemail.tmp
done

rm mailboxdir.tmp # we dont need it anymore

echo "[*] Deleting bad maildirsize files"
deletelist="`cat badmaildirsize.tmp`"
for maildirsize in $deletelist; do
   rm $maildirsize
done

echo "[*] Recreating deleted maildirsize files"
addresses="`cat fixemail.tmp`"
for emailaddress in $addresses; do
   /home/vpopmail/bin/vuserinfo -Q $emailaddress
done

echo "[*] Setting owner/group vpopmail/vchkpw on maildirsize files"
newmaildirsizefiles="`cat badmaildirsize.tmp`"
for newmaildirsize in $newmaildirsizefiles; do
   chown vpopmail:vchkpw $newmaildirsize
done


Reply via email to