1

Topic: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

Hi all!


On the current email server has app. 100 mailboxes, linux level users with Courier-imap maildirs without quota support.  I haven't any database for current emai handling. This is working, but the server is old.

I bought a new HP Proliant ML350 server for my iRedmai application. I create a new user on this server and I copied all e-mail files from my current mailbox to this test user's maildir forlder (from old server to the new Iredmail).
I set the permissions (vmail/vmail) to this e-mail files. I see all e-mails in the Roundcube application on the new server but the quota is 0%.  I calculate it to cca 50%.

I don't know exactly where stored the user's quota information. In the user' maildir folder in a dovecot file (I couldn't find) or in SQL database?
How can I rescan/rebuild the quota information?

So I created a new, clean mailbox with 1GB quota in the new iRedMail server.
I have ~500MB e-mail files in Courier-Maildir format on the old server.
I copied this files to the new mailbox, but in Roundcube "quota" bar show 0% (0B / 1024 MB).

What can I do for the quota bar show the real size?

Thanks.
Sorry for my bad English.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

mono7806 wrote:

So I created a new, clean mailbox with 1GB quota in the new iRedMail server.

iRedMail stores per-user mailbox quota in MySQL or OpenLDAP. (If you store mail accounts in MySQL, then quota is stored in MySQL.)

Did you try sending a new mail to this user or deleting one from mailbox? Dovecot should calculate automatically for you.

3 (edited by mono7806 2011-05-10 01:58:13)

Re: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

ZhangHuangbin wrote:
mono7806 wrote:

So I created a new, clean mailbox with 1GB quota in the new iRedMail server.

iRedMail stores per-user mailbox quota in MySQL or OpenLDAP. (If you store mail accounts in MySQL, then quota is stored in MySQL.)

Did you try sending a new mail to this user or deleting one from mailbox? Dovecot should calculate automatically for you.

Thank's for the quick response.
I need the Postfix admin because the e-mail aliases so I use MySQL Database backend.

I tried this but not working.
I see in phpmyadmin the users "bytes" and "messages" column. This fields is modified when I send a new mail for the user. The count is incremented and the "bytes" field is changed but only the newly sent mails.
The copied 500 MBytes e-mail's size and pieces not shown in the database. Of course this copied mails shown in the Roundcube, the file permissions are ok.
I tried to delete one and more emails from copied mails but no change. The quota shown only the new mails that becomes during the iRedMail system.

Any other ideas?

Thanks in advance.

Upd.: I think maybe the Courier Maildir file format is not good for the quota recheck. I copied from an other user's Dovecot e-mail file to the test user and I send a new mail to the test user. I think in this case the new user's "Message" field must be increment two number. But no. Only 1.
I haven't any idea sad

I tried to set up, down and turned off the quota limit and I send e-mails for the test user. But not working. The ~500MB copied mails not calculated in the quota.

4 (edited by maxie_ro 2011-05-10 15:35:33)

Re: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

If you are keeping the MySQL quota in the `mailbox` table, there isn't much you can do, unfortunately. Eventually delete the user and re-create it (the files will be kept). Otherwise dovecot will probably never recalculate the quota.

If you are storing the MySQL quota in a separate table (as originally intended), just truncate the table, and dovecot will recreate the quota at the first deleted or delivered message, whichever comes first.

On the wiki you have a tutorial about quota, with 2 examples, with the quota in the `mailbox` table, and with the quota on another table `used_quota`. Try switching to a separate table, `used_quota`. Modify dovecot.conf accordingly.

Also, refer to my original post here: [Enh] MySQL-based used quota, pay special attention to what Zhang has wrote on the last post, the format of the table depends on dovecot version.

@Zhang: as you can see, storing the quota in the `mailbox` table is not a good idea. You can't force a rebuild without deleting the user. Maybe you should modify the totorial on the wiki to have the quota stored in a separate table. smile

5

Re: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

maxie_ro wrote:

@Zhang: as you can see, storing the quota in the `mailbox` table is not a good idea. You can't force a rebuild without deleting the user. Maybe you should modify the totorial on the wiki to have the quota stored in a separate table.

Dict quota is recalculated only if the quota goes below zero (v1.0.rc30+ only).

For example:

mysql> UPDATE mailbox SET bytes=-1,messages=-1 WHERE username='user@domain.ltd';

It does work here for me. smile

6

Re: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

Sorry, yesterday I was not before the computer.

I'm tried this is working fine, thanks!
"UPDATE mailbox SET bytes=-1,messages=-1 WHERE username='user@domain.ltd';"

I also found this but I did not understand when they occur in this state but it is already clear:
"Dict quota is recalculated only if the quota goes below zero (v1.0.rc30+ only)."

maxie_ro, ZhangHuangbin: Thank you very much for support!

7

Re: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

One more question:
What is the maximum quota size in the IredMail 0.7.1?
I think not the MySQL bigint(20) fiel type is the limit (when I calcluate is good this is 16777215 TB).

Do you have information from this? This is quite difficult to test.

8

Re: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

mono7806 wrote:

What is the maximum quota size in the IredMail 0.7.1?
I think not the MySQL bigint(20) fiel type is the limit (when I calcluate is good this is 16777215 TB).

Yes, it's limited to "BIGINT(20)" and your disk storage. iRedMail doesn't restrict it.

9

Re: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

ZhangHuangbin wrote:
mono7806 wrote:

What is the maximum quota size in the IredMail 0.7.1?
I think not the MySQL bigint(20) fiel type is the limit (when I calcluate is good this is 16777215 TB).

Yes, it's limited to "BIGINT(20)" and your disk storage. iRedMail doesn't restrict it.

Thanks!

10

Re: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

Dict quota is recalculated only if the quota goes below zero (v1.0.rc30+ only).

For example:

mysql> UPDATE mailbox SET bytes=-1,messages=-1 WHERE username='user@domain.ltd';

It does work here for me. smile

It work but only after user log in... I have 9000 users on server some of them use they mail not very often... how to make this rescan quota without user log in?

11

Re: Quota rescan/rebuild? - Migrating from Courier to Dovecot question

blade wrote:

It work but only after user log in... I have 9000 users on server some of them use they mail not very often... how to make this rescan quota without user log in?

No idea yet, sorry.

Dovecot will recalculate quota when new mail arrived, or been deleted via IMAP. You can try either one.