I’ve enabled HSM/Powerstore for the first time on two systems close one to another. I needed to estimate the space occupied by the data moved by the HSM policy. How to do that?
There are no automatic tools on the Zimbra Admin nor via the CLI tools: the data I needed was on the database only.
Let’s decide we want to move five years old data, that is around 2015/08/01 as of today. Convert that date to a unix timestamp, either by shell commands or with a website. That will output 1406851200.
Now let’s produce a list of mailboxes and put them into a file. All commands must be run as zimbra user.
mysql --batch --skip-column-names -e "show databases" | grep ^mboxgroup > /tmp/mailbox.list
Now we need to sum the size of each element of the mailbox before the timestamp defined above:
for i in $(cat /tmp/mailbox.list); do cnt=0; cur=$(mysql --batch --skip-column-names -e "select sum(size) from $i.mail_item where change_date >= 1406851200"); echo "$i: $cur"; cnt=$(($cnt + $cur)); done ; echo "Total in bytes: $cnt"
Now, this is a rough estimate: it doesn’t take into consideration element types, and doesn’t care about Zimbra disk saving (an element shared between two users doesn’t take the space two times), and last but not least doesn’t consider ZeXtras Powerstore deduplication algorithm.
This means the saved space on the main storage and the one occupied on the HSM partition should be less than this.