> For the complete documentation index, see [llms.txt](https://help.glpi-project.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.glpi-project.org/procedures/free_database_space.md).

# 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.

{% hint style="info" %}
**Info**

Values are given as an example and must be modified according to your configurationyou.
{% endhint %}

{% hint style="success" %}
**Percona**

You can also use Percona to perform this type of operation on your databases. A [procedure](https://help.glpi-project.org/procedures/linux_percona_toolkit.md) is available to help
{% endhint %}

## 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](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-f4f1f3d05a76b492832115fe4780e40e0815c0ba%2FPurge_logs-1.png?alt=media)

![alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-6ead3677d213eb44b6d6bf284642c85475f22416%2FPurge_logs-2.png?alt=media)

## Automatic action configuration

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

Example schedule:

![alt text](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-b1302dee287f266ceaa8cf82ad4b04c4e1c1eded%2FPurge_logs-3.png?alt=media)

{% hint style="success" %}
**Automatic actions**

See the different [automatic actions](broken://spaces/QFOh36etagWOcP9q4ECb/pages/SIuOfxDtQlTSBswIpJLP#what-is-the-difference-between-logs-purgelogs-and-circularlogs-actions) related to logsInitial run
{% endhint %}

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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.glpi-project.org/procedures/free_database_space.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
