The more that I play with Cyrus, the less that I like it - although in fairness, when it's working it seems to run pretty well. The other day I started getting people emailing me saying that the mail server was telling them that the their mail size was over the limit.
I promptly logged into the offending mail server and did a du in order to see if the problem was user error or the mail server error. People that were at 5% of their quota were showing up in Cyrus as being 113% over quota. I ran mailq on the mail server and I got output that looked like:
[root@mailserver ~]# mailq
D9433 2305 Wed Apr 16 13:21:54 bb@nowhere.nospam.kt
(host /opt/insight/var/imap/socket/lmtp[/opt/insight/var/imap/socket/lmtp] said: 452 4.2.2 Over quota (in reply to RCPT TO command))
aa@nowhere.nospam.kt
[root@mailserver ~]#
I figured that the quota subsystem for Cyrus was playing up and in a vague hope, I tried restarting the Cyrus daemon to no avail. In the end, I found that you can tell Cyrus to fix inconsistencies in the quota subsystem by using the quota -f command. For example:
[root@mailserver ~]# su - cyrus -c "/bin/quota -f user/<username>"
Quota % Used Used Root
2048000 2 46500 user/<username>
[root@mailserver ~]#
I promptly wrote up a quick script which dumps out all of the users of the system and then applies the same command to each user (I think that this isn't neccassary as it seems that quota -f without the mailbox prefix seems to do the right thing).
[root@mailserver ~]# vi CyrusQuotaReconstruct.sh
~
#!/bin/bash
tmpfile=/opt/abowden/bin/cyrus.output
echo "lm user/%" | /opt/insight/bin/cyradm -user manager -pass ***secretpassword*** localhost | awk '/user/ { if (substr($1,1,4)!="user") print $2; else print $1 }' > ${tmpfile}
echo "Created the user file"
# assign a file pointer to the line
exec 4<${tmpfile}
until [ $done ]
do
# assign the current line to var $line
read <&4 line
if [ $? != 0 ]; then
# if we're at the end, tag it as finished
done=1
continue
fi
# Try assigning the rights to cyrus via the cyradm perl command.
# Trap all errors in the errorfile which is to be emailed out!
# An error seems to occur most frequently with System I/O error
# when the mailbox needs to be rebuilt.
su - cyrus -c "/opt/insight/bin/quota -f ${line}"
done
But as always, this worked for me (and got me out of a jam), but individual kilometrage (metricised) may vary.
Once things had calmed down, I had a chance to consult the great google oracle and found the following information about this problem at oreilly ( http://www.oreilly.com/catalog/mimap/chapter/ch09.html):
On rare occasions, a mailbox will wind up with the wrong quota root. When this happens, the cyradm listquota command will report an incorrect quota usage. A good indication that something in the quota system has gone haywire is when a user's mail is bouncing with "Deferred--quota exceeded" errors, but listquota reports that the usage is below the limit. The Cyrus distribution includes a tool, quota (8), for maintaining the consistency of the quota subsystem.
.....
It is advisable to run the quota command periodically (e.g., once per week) out of cron to keep the quota subsystem in a consistent state.
Popularity: 26% [?]


Latest Comments