I wrote a bash script to get mailbox size of all mailboxes and export it to csv. Hopefully someone finds this useful.
I would post it to the wiki put when I created by wiki account I didn't see a create page link.
Code:
#!/bin/bash
#This script exports email address & mailbox size in MB to csv for all accounts
#It was tested against a single domain setup
#For 125 accounts and 300GB total volume size it took about 5 minutes
#By James Barnett james.barnett@noc.com
cd /home/zimbra;
echo "This will take a few minutes ..."
zmprov gaa > temp.txt; #export a list all accounts to a temp file
rm -f size.csv #remove the any pervious CSV file
echo -n "Email Address, " >> size.csv
echo "Size of Mailbox in MB" >> size.csv #echo column headers to the CSV file
for i in $(cat temp.txt); #loop through the accounts
do
echo -n "$i, " >> size.csv; #echo the email address
bytes=$(zmmailbox -z -m $i getmailboxsize -v) #get mailbox size in bytes and set to variable
echo "scale=2; $bytes/1048576" | bc>> size.csv #return mailbox size in MB
done
rm -f temp.txt #remove temp file
echo "Finished! Check /home/zimbra/size.csv for results"
echo -e "\a" #Ring the system bell to let the user know the report is ready