Hello everyone!

I'm trying to figure a solution for this scenario.

I have the Dovecot IMAP using MDBOX (SIS) storage for the daily usage email.

For long term storage I'm preparing a namespace with MBOX storage.

I'm not using the altstorage logic because as far as I know it needs to have the same format as the base one and for archival I prefer to have the attachments inside the messages in an old/well known format supported by near any email software.

The problem at the moment is with quotas.

If the user has 5GB in his mailboxes and the long term "historico" namespace has another 5GB, the storage used becomes 10GB and I want the users to only see their "active" usage (5GB).

I have that space to be ignored (as defined in the wiki and dovecot documentation - my quota_rule5 ) but it doesn't seem to influence the usage reported by IMAP.

What am I doing wrong?

If I put the "historico" namespace with disabled = yes and do a "doveadm quota recalc" the values become correct but I need the namespace available so the users can recover their old messages if needed.

The relevant settings (AFAIK) I'm using are:

plugin {
  quota = dict:FileQuota:ns=:file:%h/dovecot-quota
  quota2 = dirsize:HistQuota:ns=@HISTORICO/
  quota_clone_dict = proxy::quota
  quota_grace = 10%%
  quota_rule = *:storage=24G
  quota_rule2 = Trash:storage=+128M
  quota_rule3 = Junk:storage=+64M
  quota_rule4 = INBOX:storage=+128M
  quota_rule5 = ns=@HISTORICO:ignore
}

namespace historico {
  disabled = no
  hidden = no
  ignore_on_failure = yes
  inbox = no
  list = no
  location = mbox:/mnt/mail-hist/historic/%d/%-2.2n/%n:SUBSCRIPTIONS=.imap/dovecot-subscriptions:LAYOUT=maildir++
  order = 0
  prefix = @HISTORICO/
  separator = /
  subscriptions = yes
  type = private
}
namespace inbox {
  disabled = no
  hidden = no
  ignore_on_failure = no
  inbox = yes
  list = yes
  location =
  order = 0
  prefix =
  separator = /
  subscriptions = yes
  type = private
}
userdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  auth_verbose = default
  default_fields = home=/data/domains/%d/%-2.2n/%n lport=%{lport}
  driver = sql
}

best regards to all the Dovecot community, stay safe!

-- 
Best regards,

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Pedro Ribeiro
Politécnico de Lisboa, Serviços da Presidência
Departamento de Sistemas de Informação e Comunicações
Phone:   +351 210 464 700 (general) / VoIP: 80100
Helpdesk: helpdesk@net.ipl.pt / https://www.net.ipl.pt
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=