[Dovecot] Wrong quota calculation

Cibest ML ml at cibest.com
Sat Sep 8 18:07:26 EEST 2012


On 08/09/2012 01:38, Daniel Parthey wrote:
> Cibest ML wrote:
>> We've a strange quota behavior on our dovecot servers.
>> It seems that it's somehow doubling the real used storage (or could
>> be something like twice the inbox size + size of other folders, hard
>> to know for sure).
>> It was initial setup with the maildir++ system. Now it's been
>> configured with dict and mysql table but the result is the same.
>>
>> Dovecot version : 2.1.7 (from squeeze-backports). Maildir format is used
>> As example, let's use mailbox at domain.com.
>> If I check in the quota table, I'll find :
>> - size : 697151354
>> - number of files : 1510
>>
>> Now if I check the Maildir folder on the filesystem, I'll find :
>> - size : 347960000
>> - number of files : 824 (using find . -type f|grep -v dovecot|wc -l,
>> not 100% accurate)
>>
>> Another mail box
>> Reported by dovecot : 503446986    1081
>> Filesystem                     : 248592000    598
>>
>> Does anyone has an idea of what could be possibly wrong. We've
>> checked & double-checked everything and nothing seems to be wrong
>> (no dsync used).
> What happens after quota resync? Does the quota change?
>
> What happens to the "doveadm quota get" output after LMTP/LDA delivery
> of a mail with a fixed-size, let's say one mail with 1 MB?
>
> How does your setup look like? Mailbox+Director Proxy or only Mailboxes?
>
> What is your doveconf -n output of mailbox (and possibly director)?
>
> Regards
> Daniel
Hi Daniel,
Thanks for your answer
Here are some tests to show the problem. The test mailbox is initialy 
empty. All described actions are done in a sequencial way (test mail 
with an attachement of ~2Mo)

- Message delivered by LMTP
Quota name Type    Value  Limit
User quota STORAGE  2653 524288
User quota MESSAGE     1      -

- quota recalc
Quota name Type    Value  Limit
User quota STORAGE  5307 524288
User quota MESSAGE     2      -

- move to draft + compact
Quota name Type    Value  Limit
User quota STORAGE  2653 524288
User quota MESSAGE     1      -

- recalc
Quota name Type    Value  Limit
User quota STORAGE  2653 524288
User quota MESSAGE     1      -

- move to subfolder "test" in inbox
User quota STORAGE  2653 524288
User quota MESSAGE     1      -

- move message back to inbox
Quota name Type    Value  Limit
User quota STORAGE  5306 524288
User quota MESSAGE     2      -

- compact
Quota name Type    Value  Limit
User quota STORAGE  2653 524288
User quota MESSAGE     1      -

- recalc quota
Quota name Type    Value  Limit
User quota STORAGE  5306 524288
User quota MESSAGE     2      -


No dovecot director is used at the moment (it's planned). There's one 
server handling incoming mails (postfix + LMTP), one for IMAP/POP 
(dovecot) & one for email sending (postfix).

dovecot -n output of incoming mails server

# 2.1.7: /etc/dovecot/dovecot.conf
# OS: Linux 3.4.1 Debian 6.0.5 ext4
dict {
   quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
}
mail_gid = 1500
mail_home = /data/hosting/mail%h/%d/%n
mail_location = maildir:/data/hosting/mail%h/%d/%n/Maildir
mail_nfs_storage = yes
mail_plugins = " quota autocreate"
mail_uid = 1500
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope 
encoded-character vacation subaddress comparator-i;ascii-numeric 
relational regex imap4flags copy include variables body enotify 
environment mailbox date ihave
namespace inbox {
   inbox = yes
   location =
   prefix =
}
passdb {
   args = /etc/dovecot/dovecot-sql.conf.ext
   driver = sql
}
plugin {
   autocreate = Inbox
   autocreate2 = Trash
   autocreate3 = Sent
   autocreate4 = Spam
   autocreate5 = Drafts
   autosubscribe = Inbox
   autosubscribe2 = Trash
   autosubscribe3 = Sent
   autosubscribe4 = Spam
   autosubscribe5 = Drafts
   quota = dict:User quota::noenforcing:proxy::quota
   quota_rule = *:storage=512M
   quota_rule2 = Trash:storage=+100M
   quota_warning = storage=90%% quota-warning 95 %u
   quota_warning2 = storage=80%% quota-warning 80 %u
   sieve = /data/hosting/mail%h/%d/%n/sieve/.dovecot.sieve
   sieve_before = /etc/dovecot/globalsieve
   sieve_dir = /data/hosting/mail%h/%d/%n/sieve/
}
protocols = " lmtp sieve"
quota_full_tempfail = yes
service auth {
   unix_listener auth-userdb {
     group = vmail
     mode = 0660
     user = vmail
   }
}
service dict {
   unix_listener dict {
     group = vmail
     mode = 0600
     user = vmail
   }
}
service lmtp {
   inet_listener lmtp {
     address = 10.3.65.71 127.0.0.1 ::1
     port = 2055
   }
   unix_listener /var/spool/postfix/private/dovecot-lmtp {
     group = postfix
     mode = 0660
     user = postfix
   }
   user = vmail
}
ssl_cert = </etc/ssl/certs/dovecot.pem
ssl_key = </etc/ssl/private/dovecot.pem
userdb {
   driver = prefetch
}
userdb {
   args = /etc/dovecot/dovecot-sql.conf.ext
   driver = sql
}
protocol lmtp {
   mail_plugins = " quota sieve autocreate"
}
protocol lda {
   mail_plugins = " quota"
}

*IMAP/POP server conf*

# 2.1.7: /etc/dovecot/dovecot.conf
# OS: Linux 3.4.1-ipv6-64-cibest-grsec x86_64 Debian 6.0.5 ext4
auth_mechanisms = plain login
dict {
   quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
}
disable_plaintext_auth = no
mail_gid = 1500
mail_home = /data/hosting/mail%h/%d/%n
mail_location = 
maildir:/data/hosting/mail%h/%d/%n/Maildir:INDEX=/data/hosting/mailcache%h/%d/%n
mail_nfs_storage = yes
mail_plugins = " quota autocreate"
mail_uid = 1500
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope 
encoded-character vacation subaddress comparator-i;ascii-numeric 
relational regex imap4flags copy include variables body enotify 
environment mailbox date ihave
namespace inbox {
   inbox = yes
   location =
   prefix =
}
passdb {
   args = /etc/dovecot/dovecot-sql.conf.ext
   driver = sql
}
plugin {
   autocreate = Inbox
   autocreate2 = Trash
   autocreate3 = Sent
   autocreate4 = Spam
   autocreate5 = Drafts
   autosubscribe = Inbox
   autosubscribe2 = Trash
   autosubscribe3 = Sent
   autosubscribe4 = Spam
   autosubscribe5 = Drafts
   quota = dict:User quota::noenforcing:proxy::quota
   quota_rule = *:storage=512M
   quota_rule2 = Trash:storage=+100M
   sieve = /data/hosting/mail%h/%d/%n/sieve/.dovecot.sieve
   sieve_before = sieve_before = /etc/dovecot/globalsieve
   sieve_dir = /data/hosting/mail%h/%d/%n/sieve/
}
protocols = " imap sieve pop3"
service auth-worker {
   user = $default_internal_user
}
service auth {
   inet_listener {
     port = 63200
   }
   unix_listener /var/spool/postfix/private/auth {
     group = postfix
     mode = 0666
     user = postfix
   }
   unix_listener auth-userdb {
     group = vmail
     mode = 0660
     user = vmail
   }
}
service dict {
   unix_listener dict {
     group = vmail
     mode = 0600
     user = vmail
   }
}
service imap-login {
   inet_listener imap {
     port = 143
   }
   inet_listener imaps {
     port = 993
     ssl = yes
   }
   process_min_avail = 4
   service_count = 1
   vsz_limit = 256 M
}
service managesieve-login {
   inet_listener sieve {
     port = 4190
   }
   process_min_avail = 5
   service_count = 0
}
service pop3-login {
   inet_listener pop3 {
     port = 110
   }
   inet_listener pop3s {
     port = 995
     ssl = yes
   }
}
ssl_ca = /etc/ssl/certs/xxxSSLCA.pem
ssl_cert = </etc/ssl/certs/xxx_com.crt
ssl_key = </etc/ssl/private/xxx_com.key
userdb {
   driver = prefetch
}
protocol lda {
   mail_plugins = " quota"
}
protocol imap {
   mail_plugins = " quota imap_quota autocreate"
}
protocol pop3 {
   mail_plugins = " quota"
}

Hope it'll help nailing the issue

--
Regards
Sébastien



More information about the dovecot mailing list