---
title: "Using disk space in a Kafka cluster"
sidebar_label: "Using disk space"
sidebar_position: 10
description: "How disk space is used in a Kafka cluster and how to free up disk space"
---

import Formbricks from '@theme/MDXComponents/Formbricks';
import MoreVerticalIcon from '@selectel/docux/icons/more-vertical';
import { CustomTable } from '@selectel/docux/components';

# Using disk space in a Kafka cluster

In Managed Databases, some disk space is reserved for service needs. The total reserved space depends on the [Kafka](/managed-databases/kafka/configurations.mdx#versions) version.

<CustomTable>
  <table data-sticky>
    <thead>
      <tr>
        <th />

        <th>Kafka 3.5</th><th>Kafka 4.1</th>
      </tr>
    </thead>

    <tbody>
      <tr>
        <th>File system reservation</th><td>4% of disk capacity</td><td>4% of disk capacity</td>
      </tr>

      <tr>
        <th>
          Reservation for the operating system,<br />service components, and logs
        </th>

        <td>8 GB</td><td>15 GB</td>
      </tr>
    </tbody>
  </table>
</CustomTable>

The reserved portion of the disk space is not available for hosting databases. Take this into account when choosing a [configuration lineup](/managed-databases/kafka/configurations.mdx).

You can monitor disk occupancy using [disk occupancy notifications](#disk-full-notifications) and metrics. Learn more about metrics in the [Monitoring Kafka clusters and nodes](/managed-databases/kafka/monitoring.mdx) guide.

When a cluster disk is 95% full or more, the cluster will enter the `DISK_FULL` status and will be set to read-only mode. This is necessary to prevent the cluster from becoming completely locked or corrupted due to a lack of free space. To restore read and write operations, [free up disk space](#free-up-disk-space) or [scale the cluster](/managed-databases/kafka/resize-cluster.mdx) and select a configuration with a larger disk size than the previous one.

## Disk occupancy notifications \{#disk-full-notifications}

Disk occupancy notifications are sent to the email addresses of the [Account Owner](/access-control/user-types.mdx#account-owner) and [panel users](/access-control/user-types.mdx#panel-users) who are subscribed to the [notification category](/account/notifications.mdx#notification-categories) "Services". Notifications are sent when the disk is 80% and 95% full.

## Free up disk space \{#free-up-disk-space}

To free up disk space, you can:

* [delete a topic](#delete-topic);
* [configure a data cleanup policy](#set-up-data-cleanup-policy).

### Delete a topic \{#delete-topic}

1. In the [Dashboard](https://my.selectel.ru/vpc/default/dbaas/), on the top menu, click **Products** and select **Managed Databases**.
2. Open the **Active** tab.
3. Open the cluster page → **Topics** tab.
4. In the <MoreVerticalIcon /> menu of the topic, select **Delete**.
5. Enter the topic name to confirm deletion.
6. Click **Delete**.

### Configure a data cleanup policy \{#set-up-data-cleanup-policy}

:::warning

After changing the `log.retention.minutes` and `log.retention.hours` parameters in the DBMS settings, the cluster will be restarted and will be unavailable during the restart.

:::

To speed up disk cleanup, change the data retention policy in the cluster settings. Kafka will automatically delete data based on the new rules.

1. In the [Dashboard](https://my.selectel.ru/vpc/default/dbaas/), click **Products** in the top menu and select **Managed Databases**.
2. Open the **Active** tab.
3. Open the cluster page → **Settings** tab.
4. In the **DBMS settings** block, click **Edit**.
5. Specify the new values for the [data retention policy parameters](#parameters-for-setup-data-cleanup-policy).
6. Click **Save**.

### Parameters for configuring a data cleanup policy \{#parameters-for-setup-data-cleanup-policy}

<CustomTable>
  <table>
    <tbody>
      <tr>
        <th>[log.segment.bytes](https://kafka.apache.org/documentation/#brokerconfigs_log.segment.bytes)</th><td>The maximum size of a single segment in a topic partition in bytes. Once the current segment is full, Kafka will create a new one. The default value is `1 073 741 824`</td>
      </tr>

      <tr>
        <th>[log.retention.bytes](https://kafka.apache.org/documentation/#brokerconfigs_log.retention.bytes)</th><td>The maximum size of a topic partition in bytes. Once the partition is full, Kafka will start deleting old segments. The default value is `-1` (no size limit)</td>
      </tr>

      <tr>
        <th>[log.retention.ms](https://kafka.apache.org/documentation/#brokerconfigs_log.retention.ms)</th><td>Segment retention time in milliseconds. If not set, the `log.retention.minutes` parameter is used. If `-1` is specified, there is no retention limit, even if `log.retention.minutes` or `log.retention.hours` are set</td>
      </tr>

      <tr>
        <th>[log.retention.minutes](https://kafka.apache.org/documentation/#brokerconfigs_log.retention.minutes)</th><td>Segment retention time in minutes. If not set, the `log.retention.hours` parameter is used</td>
      </tr>

      <tr>
        <th>[log.retention.hours](https://kafka.apache.org/documentation/#brokerconfigs_log.retention.hours)</th><td>Segment retention time in hours. Used if the `log.retention.ms` and `log.retention.minutes` parameters are not set. The default value is `168`</td>
      </tr>
    </tbody>
  </table>
</CustomTable>

<Formbricks />
