Zimbra Community Mailbox Size CentOS 6

To find the mailbox size of an individual user for Zimbra, you have to be logged into Zimbra as the Zimbra user

su - zimbra
whoami returning zimbra after switching to the zimbra user

The Zimbra command-line tools live in /opt/zimbra/bin and are meant to be run as the zimbra user, which also has the right environment and admin credentials set up. whoami should return zimbra before you continue.

The zmmailbox command

all commands in relation to mailbox are handled by the zmmailbox command,

Let’s start at the beginning, the only way to learn a system in-and-out is to study the help

zmmailbox -h
zmmailbox -h usage: -z zadmin, -m mailbox, -a admin, -p password and other options

The options used below are -z (authenticate as the Zimbra admin using the credentials stored in localconfig, so no password is needed) and -m (the mailbox to open).

Get the size of one mailbox

let’s move on to an example!

zmmailbox -z -m user@mydomain.com gms
zmmailbox -z -m user@mydomain.com gms to get the mailbox size

here’s an example on how to get info on the mailbox for user@mydomain.com, the z means use zimbra admin, and the m specifies a mailbox

zmmailbox gms output: 205.94 MB

as you can see, it outputs the value of the mailbox size.

gms is short for getMailboxSize. The value includes every folder, including Sent, Trash and Briefcase, so it is the number that counts against the user’s quota.

Message counts per folder

if you want to see the amount of emails in individual folders, issue the following:

zmmailbox -z -m user@mydomain.com gaf
zmmailbox -z -m user@mydomain.com gaf to list all folders

it outputs as follows:

zmmailbox gaf output: folder Id, View, Unread, Msg Count and Path for Inbox, Sent, Contacts and more

gaf (getAllFolders) lists each folder with its Id, view type, unread count, message count and path. It is the quickest way to find the folder that holds most of the mail, which is usually Sent, Inbox or Trash.

All accounts at once

To list usage for every account on a mailbox server, use zmprov instead:

zmprov getQuotaUsage mail.mydomain.com

Replace the name with your mailbox server’s hostname (zmhostname prints it). The output has one line per account: the account name, its quota and the space used, both in bytes. Sorting it, for example with sort -k3 -n -r, shows the largest mailboxes first.

Troubleshooting

  • command not found: you are not the zimbra user, or used su zimbra without the dash so the PATH was not loaded.
  • account.NO_SUCH_ACCOUNT: the address is misspelled or the account does not exist on this server; check it with zmprov ga user@mydomain.com.
  • Size looks too large: empty the user’s Trash and Junk folders, which still count toward the total.

The same commands work on current Zimbra releases, which run on RHEL 8/9-family systems and Ubuntu LTS rather than CentOS 6. For related admin tasks see Restart Zimbra Community Services and Migrate Zimbra Community to New Server.

That’s it! Hosted Linux Servers at www.zwiegnet.com/go

Related guides: Find out what version of Zimbra you are running | Get member of Zimbra Distribution group command line

Leave a Reply

Your email address will not be published. Required fields are marked *