[Dovecot] Dovecot usage values differ from actual disk usage

Daniel Parthey daniel.parthey at informatik.tu-chemnitz.de
Thu May 17 21:11:58 EEST 2012


Hi Timo,

Timo Sirainen wrote:
> On Sun, 2012-05-13 at 02:07 +0200, Daniel Parthey wrote:
> 
> > in my dovecot setup the accounting database table shows wrong
> > values which do not correspond with the actual disk space used.
> 
> Can you easily reproduce this with a test user? How?

Maybe this is not the original problem, but here is some way to
reproduce a similar behaviour.

#####################
# Close Thunderbird #
#####################

#################
# Clear Mailbox #
#################

rm -rf /mail/dovecot/example.org/user1
sleep 1
doveadm quota recalc -u user1 at example.org

###############
# Check quota #
###############

# doveadm quota get -u user1 at example.org
Quota name                                                                                           Type    Value Limit %
User quota                                                                                           STORAGE     0     - 0
User quota                                                                                           MESSAGE     0     - 0

################
# Deliver mail #
################

{
cat <<EOF
LHLO localhost
MAIL FROM:<user2 at example.org>
RCPT TO:<user1 at example.org>
DATA
EOF
dd if=/dev/zero count=1 bs=1M | base64
cat <<EOF
.
QUIT
EOF
} | nc localhost 19024

###############
# Check quota #
###############

# doveadm quota get -u user1 at example.org
Quota name                                                                                           Type    Value Limit %
User quota                                                                                           STORAGE  1383     - 0
User quota                                                                                           MESSAGE     1     - 0

#######################
# Check mdbox storage #
#######################

du -sk /mail/dovecot/example.org/user1
1432    /mail/dovecot/example.org/user1

#####################
# Move Email around #
#####################

Move Email two times between Trash and INBOX (4 moves in total).
There is still only one physical message, just moved it around a bit.

#####################
# Check quota again #
#####################

# doveadm quota get -u user1 at example.org
Quota name                                                                                           Type    Value Limit %
User quota                                                                                           STORAGE  6918     - 0
User quota                                                                                           MESSAGE     5     - 0

Quota now displays 5 messages and 6 MB, even though there is only one message with 1.5 MB.

#######################
# Check mdbox storage #
#######################

# du -sk /mail/dovecot/example.org/user1
1472    /mail/dovecot/example.org/user1

The actual disk usage did not increase, but the "usage value" did increase
with every move operation.

As long as the client has its MUA open, the usage is incorrectly displayed
(and accounted), and does not correspond with actual disk usage.

#####################
# Close Thunderbird #
#####################

The mailboxes get expunged.

#####################
# Check quota again #
#####################

# doveadm quota get -u user1 at example.org
Quota name                                                                                           Type    Value Limit %
User quota                                                                                           STORAGE  1383     - 0
User quota                                                                                           MESSAGE     1     - 0

Usage value and message count is correct again, once thunderbird is closed.

#######################
# Check mdbox storage #
#######################

# du -sk /mail/dovecot/example.org/user1
1472    /mail/dovecot/example.org/user1

The actual disk usage did not change, which is OK.
> 
> In the tests does it make difference if you bypass director?

No. The behaviour is the same if I access the mailbox directly.

Regards,
Daniel


More information about the dovecot mailing list