Skip to content

Free up space on your database#

This procedure frees up disk space in a gradual process, which can take several days or weeks. Once all the steps have been completed, it will be necessary to temporarily increase the disk space in order to rebuild the database, thus recovering space and then reducing the disk size again.

Info

Values are given as an example and must be modified according to your configuration

Percona

You can also use Percona to perform this type of operation on your databases. A procedure is available to help you.

Initial configuration#

Access the menu Setup > General > History Purge to set up the purging of the two main space-consuming sections: Software and Users.

Steps :

  • Initial setup
  • In the Software section, set all three fields to 60 months.
  • In the Users section, set the four fields to 60 months for an initial test.

alt text

alt text

Automatic action configuration#

From Setup > Automatic actions, configure purgelogs to run daily outside business hours.

Example schedule:

alt text

Automatic actions

See the different automatic actions related to logs

Initial run#

Let the automatic action run overnight.

Then check the Logs tab in the automatic action to verify the number of lines deleted.

Gradual adjustment of parameters#

Leave the automatic action running overnight.

Then check the Logs tab in the automatic action to see how many lines have been deleted.

Gradual adjustment of parameters#

Once the number of deleted lines reaches 0 or close to 0, gradually reduce the retention period (previously set to 60 months) to 55 months.

Repeat the cleaning steps until you reach the desired minimum history duration.

Temporary increase in disk space#

Once the cleanup is complete, it will be necessary to temporarily increase disk space (to almost double the current size) to perform the following operation.

Database optimization#

After deleting a large volume of data (e.g. from the glpi_logs table), you may notice that the disk space used does not immediately decrease at file system level. This is normal due to the operation of the InnoDB storage engine.

Procedure: Run the following command to optimize the table and reclaim disk space:

ALTER TABLE <table_name> ENGINE=InnoDB;

This command rebuilds the table indexes while ensuring data security and freeing up unused space.