DB not releasing disk space after deleting data

DB not releasing disk space after deleting data

   KB 21729        Last updated on 07/11/2015  




0.00
(0 votes)

Purpose

After deleting data on the Zimbra DB (MySQL/MariaDB) through account deletion or moving accounts to a different mailbox server using zmmboxmove (or older zmmailboxmove with purge), we're not seeing disk space being released at /opt/zimbra/db/data. This could be a problem on servers with a very high number of accounts that were deleted or moved.

Resolution

If we delete data from MySQL/MariaDB, there is no way to release disk space unless we use InnoDB's innodb_file_per_table feature which is enabled by default with Zimbra. What is important to notice is that MySQL/MariaDB does not release disk space automatically, so we will always need to run the command "OPTIMIZE TABLE" for every table. This should not cause any problems with Zimbra, but we have to be careful about a few things:

  • MySQL/MariaDB locks the table during the time "OPTIMIZE TABLE" is running so we recommend you perform this operation on a scheduled downtime (stop mailboxd process and manually start the DB for running this operation). Do one table at a time. This may take a considerable time for big databases on busy environments. We don't want mailboxd running when you do this operation.
  • For InnoDB tables, "OPTIMIZE TABLE" is mapped to "ALTER TABLE", which rebuilds the table to update index statistics and free unused space in the clustered index. So the message "Table does not support optimize, doing recreate + analyze instead" is normal.
  • During this process, MariaDB might need to create a temporary file that will require additional temporary disk space on the partition, so you can end up in the situation where you were have no available space left and the process will abort. This can be an issue since we are trying to release space. A possible solution is to perform a db dump/reload instead.
  • Please run this command using screen or any other tool that will not abort the operation if your terminal connection suddenly closes due to some error or network timeout.

Additional Content


Verified Against: Zimbra Collaboration 8.6, 8.5, 8.0 Date Created: 02/27/2015
Article ID: https://wiki.zimbra.com/index.php?title=DB_not_releasing_disk_space_after_deleting_data Date Modified: 07/11/2015



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Wiki/KB reviewed by Fred Phil Jenny Last edit by Jorge de la Cruz
Jump to: navigation, search