Hi,
I am trying to get quota working properly on dovecot 1.2.3 with postfix admin,
amavisd-new, mysql, and postfix.
So far I can see the db getting updated when messages are added and deleted
from the mailbox. The problem I am having is that I have imported a bunch of
messages from the old mail server that was running uw-imap and mbox to the
doevcot machine using maildir++. As a result the quotas used only reflects
what has been added and deleted since the import was done.
What is the proper way to get the quota in the database to reflect what is
actually in the users mailbox?
Google and the wiki have not been helpful to me in figuring this out.
I do not really think this is a config problem but in case it is below is the
output of dovecot-n:
(vfoggy pts7) # dovecot -n
# 1.2.3: /etc/dovecot.conf
# OS: Linux 2.6.18-128.4.1.el5xen x86_64 CentOS release 5.3 (Final)
protocols: imap imaps pop3 pop3sa managesieve
listen: *
login_dir: /var/run/dovecot/login
login_executable(default): /usr/libexec/dovecot/imap-login
login_executable(imap): /usr/libexec/dovecot/imap-login
login_executable(pop3): /usr/libexec/dovecot/pop3-login
login_executable(managesieve): /usr/libexec/dovecot/managesieve-login
first_valid_uid: 512
last_valid_uid: 512
first_valid_gid: 512
last_valid_gid: 512
mail_location: maildir:~/
mail_executable(default): /usr/libexec/dovecot/imap
mail_executable(imap): /usr/libexec/dovecot/imap
mail_executable(pop3): /usr/libexec/dovecot/pop3
mail_executable(managesieve): /usr/libexec/dovecot/managesieve
mail_plugins(default): quota
mail_plugins(imap): quota
mail_plugins(pop3): quota
mail_plugins(managesieve):
mail_plugin_dir(default): /usr/lib64/dovecot/imap
mail_plugin_dir(imap): /usr/lib64/dovecot/imap
mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3
mail_plugin_dir(managesieve): /usr/lib64/dovecot/managesieve
imap_client_workarounds(default): outlook-idle delay-newmail
imap_client_workarounds(imap): outlook-idle delay-newmail
imap_client_workarounds(pop3):
imap_client_workarounds(managesieve):
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
pop3_client_workarounds(managesieve):
lda:
postmaster_address: postmaster at tntechs.com
mail_plugins: sieve quota
auth default:
mechanisms: plain login
user: nobody
worker_max_count: 50
passdb:
driver: sql
args: /etc/dovecot/sql.conf
userdb:
driver: static
args: uid=512 gid=512 home=/var/spool/vmail/domains/%d/%n
userdb:
driver: sql
args: /etc/dovecot/sql.conf
socket:
type: listen
client:
path: /var/spool/postfix/private/auth
mode: 432
user: postfix
group: vmail
master:
path: /var/run/dovecot/auth-master
mode: 432
user: vmail
group: vmail
plugin:
quota: dict:user::proxy::quotadict
sieve: ~/.dovecot.sieve
sieve_storage: ~/sieve
acl: vfile:/etc/dovecot/acls
trash: /etc/dovecot/trash.conf
dict:
quotadict: mysql:/etc/dovecot/dovecot-dict-quota.conf
(vfoggy pts7) #
In addition below is what I have in dovecot-dict-quota.conf:
map {
pattern = priv/quota/storage
table = quota
username_field = username
value_field = bytes
}
map {
pattern = priv/quota/messages
table = quota
username_field = username
value_field = messages
}
--
Regards,
Tom Diehl tdiehl at rogueind.com Spamtrap address mtd123 at
rogueind.com
On Thu, 2009-08-13 at 10:31 -0400, Tom Diehl wrote:> What is the proper way to get the quota in the database to reflect what is > actually in the users mailbox?..> quota: dict:user::proxy::quotadict..> quotadict: mysql:/etc/dovecot/dovecot-dict-quota.confYou should be able to just delete the user's quota row from SQL and then log in as the user and issue "GETQUOTAROOT INBOX" command. That should recalculate the quota, and in my tests a few days ago it did. But some other guy said that he couldn't get it to work.. So, let me know if there is a problem. Actually it should be possible to just delete the row and let Dovecot recalculate the quota on next update, but currently this isn't working. I've a half-finished patch to make it work, but it's a pretty big change. v1.2.4 anyway hopefully has it. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20090813/16f246ce/attachment-0002.bin>
Hi Timo, Thanks for the reply. On Thu, 13 Aug 2009, Timo Sirainen wrote:> On Thu, 2009-08-13 at 10:31 -0400, Tom Diehl wrote: >> What is the proper way to get the quota in the database to reflect what is >> actually in the users mailbox? > .. >> quota: dict:user::proxy::quotadict > .. >> quotadict: mysql:/etc/dovecot/dovecot-dict-quota.conf > > You should be able to just delete the user's quota row from SQL and then > log in as the user and issue "GETQUOTAROOT INBOX" command. That should > recalculate the quota, and in my tests a few days ago it did. But some > other guy said that he couldn't get it to work.. So, let me know if > there is a problem.I tried issuing the "GETQUOTAROOT INBOX" command from a telnet session but it would seem I am doing something wrong. Below is the telnet session: (vfoggy pts3) # telnet localhost 143 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready. 1 login myusername at mydomain.com my_passwd 1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH] Logged in 2 GETQUOTAROOT INBOX 2 BAD Error in IMAP command GETQUOTAROOT: Unknown command. 3 logout * BYE Logging out 3 OK Logout completed. Connection closed by foreign host. (vfoggy pts3) # With debugging turned on I see the following in the logs when I login: ... Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername at mydomain.com): Loading modules from directory: /usr/lib64/dovecot/imap Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername at mydomain.com): Module loaded: /usr/lib64/dovecot/imap/lib10_quota_plugin.so Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername at mydomain.com): Effective uid=512, gid=512, home=/var/spool/vmail/domains/mydomain.com/myusername Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername at mydomain.com): Quota root: name=user backend=dict args=:proxy::quotadict Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername at mydomain.com): dict quota: user=myusername at mydomain.com, uri=proxy::quotadict, noenforcing=0 Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername at mydomain.com): maildir: data=~/ ... When I issue the GETQUOTAROOT command there is nothing logged. I did this before I deleted the row in SQL so that I could see what it returned but I suspect that would not make it return "Unknown command". What am I missing? Regards, -- Tom Diehl tdiehl at rogueind.com Spamtrap address mtd123 at rogueind.com
On Thu, 13 Aug 2009, Timo Sirainen wrote:> On Thu, 2009-08-13 at 10:31 -0400, Tom Diehl wrote: >> What is the proper way to get the quota in the database to reflect what is >> actually in the users mailbox? > .. >> quota: dict:user::proxy::quotadict > .. >> quotadict: mysql:/etc/dovecot/dovecot-dict-quota.conf > > You should be able to just delete the user's quota row from SQL and then > log in as the user and issue "GETQUOTAROOT INBOX" command. That should > recalculate the quota, and in my tests a few days ago it did. But some > other guy said that he couldn't get it to work.. So, let me know if > there is a problem.Thanks for the help. It seems to be working now.> > Actually it should be possible to just delete the row and let Dovecot > recalculate the quota on next update, but currently this isn't working. > I've a half-finished patch to make it work, but it's a pretty big > change. v1.2.4 anyway hopefully has it.I am looking fwd to this fix. I have several thousand mailboxes to migrate in the next few weeks. Not something that is really practical to do by hand. Maybe I could script something using expect and a modified db query so that I do not have to know all of the users passwds. Does that sound reasonable? Regards, -- Tom Diehl tdiehl at rogueind.com Spamtrap address mtd123 at rogueind.com
On Fri 14 Aug 2009 02:51:33 AM CEST, Timo Sirainen wrote> You should be able to just delete the user's quota row from SQL and then > log in as the user and issue "GETQUOTAROOT INBOX" command. That should > recalculate the quota, and in my tests a few days ago it did. But some > other guy said that he couldn't get it to work.. So, let me know if > there is a problem.in 1.1.16 i have also a problem with quotas, maildirsize file is not created with new size when mailbox is maked, and if qoutas in sql changes, then the maildirsize file does not follow * QUOTAROOT "INBOX" "storage=1024000" * QUOTA "storage=1024000" (STORAGE 860298 2096128) Getquotaroot completed. after mysql changed from 2G to 1G qoutas -- xpoint