[Dovecot] Quota question.
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@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@rogueind.com Spamtrap address mtd123@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.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.
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.
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@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@mydomain.com): Loading modules from directory: /usr/lib64/dovecot/imap Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername@mydomain.com): Module loaded: /usr/lib64/dovecot/imap/lib10_quota_plugin.so Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername@mydomain.com): Effective uid=512, gid=512, home=/var/spool/vmail/domains/mydomain.com/myusername Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername@mydomain.com): Quota root: name=user backend=dict args=:proxy::quotadict Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername@mydomain.com): dict quota: user=myusername@mydomain.com, uri=proxy::quotadict, noenforcing=0 Aug 14 08:02:20 vfoggy dovecot: IMAP(myusername@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@rogueind.com Spamtrap address mtd123@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@rogueind.com Spamtrap address mtd123@rogueind.com
On Sun, 2009-08-16 at 09:09 -0400, Tom Diehl wrote:
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.
Looks like it doesn't make it for v1.2.4. v1.2.5 then.
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.
Do all your users use the same UID? There's an easier way to do this then:
echo "1 getquotaroot inbox" | USER=username dovecot --exec-mail imap
On Mon, 17 Aug 2009, Timo Sirainen wrote:
On Sun, 2009-08-16 at 09:09 -0400, Tom Diehl wrote:
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.
Looks like it doesn't make it for v1.2.4. v1.2.5 then.
:-(
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.
Do all your users use the same UID? There's an easier way to do this
Yes, they do.
then:
echo "1 getquotaroot inbox" | USER=username dovecot --exec-mail imap
That is really cool!!
Thanks for the help.
I really appreciate it.
Enjoy your vacation!!
Regards,
-- Tom Diehl tdiehl@rogueind.com Spamtrap address mtd123@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
On Fri, 2009-08-28 at 23:43 +0200, Benny Pedersen wrote:
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
That's a completely different problem, you should have just started a new thread instead of replying. Anyway, post your dovecot -n output and dovecot-sql.conf contents.
On Fri, August 28, 2009 23:46, Timo Sirainen wrote:
On Fri, 2009-08-28 at 23:43 +0200, Benny Pedersen wrote:
On Fri 14 Aug 2009 02:51:33 AM CEST, Timo Sirainen wrote 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 That's a completely different problem, you should have just started a new thread instead of replying. Anyway, post your dovecot -n output and dovecot-sql.conf contents.
okay, did not know that, attached is my dovecot n and sql conf
-- xpoint
On Aug 28, 2009, at 6:00 PM, Benny Pedersen wrote:
On Fri, August 28, 2009 23:46, Timo Sirainen wrote:
On Fri, 2009-08-28 at 23:43 +0200, Benny Pedersen wrote:
On Fri 14 Aug 2009 02:51:33 AM CEST, Timo Sirainen wrote 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 That's a completely different problem, you should have just started a new thread instead of replying. Anyway, post your dovecot -n output
and dovecot-sql.conf contents.okay, did not know that, attached is my dovecot n and sql conf
The problem is
user_query = SELECT concat('/home/vmail/', maildir) AS home,
concat('/home/vmail/', maildir) AS maildir, 125 AS uid, 125 AS gid,
concat('maildir:storage=', floor(quota/1024)) AS quota FROM mailbox
WHERE username = '%u'
that you're trying to use v1.0 quota configuration with v1.1. You'll
need in dovecot.conf:
plugin { quota = maildir }
and in user_query:
.., concat('*:bytes=', quota) AS quota_rule FROM ..
participants (3)
-
Benny Pedersen
-
Timo Sirainen
-
Tom Diehl