Hello everyone. I hope you are all doing well and staying safe!
I wanted to document this procedure for clearing out an email box in Zimbra. I recently had to update my Zimbra mail server and I noticed that my admin account was strangely full. Over 200,000 messages in the inbox. Looking at it, they ended up being storage alerts that the Core snap in my Ubuntu Server was out of disk space. This is normal for snaps since they are SquashFS file systems for the applications they run and that is how they are designed. However, the amount of alerts was quite amazing.
Since I’m not using snaps on this system, I removed the core snap and all of it’s revisions, and then removed snapd from the system so that the alerts would stop. I did this by doing the following:
$ sudo snap list --all
This listed all the snaps and revisions running on my mail server. I then noted the revision number and removed all the disabled snap versions of core by running the following:
$ sudo snap remove --revision=xxx core
xxx is the revision number of the snap. I ran this twice since snaps only keep the previous two versions by default. I than deleted snapd from the system so that it won’t update and remove the core snap from the system:
$ sudo apt purge snapd
After this ran, I ran
df -h to verify that the
/dev/loop2 which is where core was mounted on my system was no longer mounted, which it wasn’t. Since I don’t plan on using snaps on this system, I have no issues.
Next, I needed to delete the over 200,000 alerts in the admin account. I tried to use the web UI to do this, but it was taking forever. After some Google searching and reading the Zimbra documents, I found out about the command
Since I didn’t care about any of the email in the mailbox, I was ready to just delete the entire contents. Use the following commands to do it:
$ ssh mailhost.example.net $ sudo su - zimbra $ zmmailbox mbox> adminAuthenticate -u https://mailhost.example.net:7071 firstname.lastname@example.org adminpassword mbox> selectMailbox email@example.com mbox firstname.lastname@example.org> emptyFolder /Inbox mbox email@example.com> emptyFolder /Trash mbox firstname.lastname@example.org> exit $ exit
It took a little while after the
emptyFolder command but it cleared out the inbox and trash folders.
Let me know if this helps you.