[Yandex Cloud documentation](../../../index.md) > [All solutions](../../index.md) > [Managed Service for PostgreSQL](../index.md) > Restoring a Managed Service for PostgreSQL cluster after running out of free storage space

# Restoring a Managed Service for PostgreSQL cluster after running out of free storage space


## Issue description {#issue-description}

* The Managed Service for PostgreSQL cluster is running in read-only mode.
* Any writes to the cluster's database tables fail.

## Diagnostics and issue reproduction {#issue-diagnostics-and-reproduction}

Go to the **Monitoring** tab in the [management console](https://console.yandex.cloud), open the `Disk capacity on primary` chart, and review the ratio between the `free` and `used bytes` values to estimate the percentage of cluster storage utilization.

{% note info %}

When the storage is more than 95% full, the host will automatically switch to `read-only` mode. In this case, the `ALTER DATABASE` statement sets the `DEFAULT_TRANSACTION_READ_ONLY = TRUE` flag for all databases.

In this mode, any `INSERT`, `DELETE`, or `UPDATE` operations return an error.

{% endnote %}

## Solution {#issue-resolution}

You can avoid this by setting up an alert to monitor switching to `read-only` mode. To learn more about how to set it up, see [this article on Managed Service for PostgreSQL](../../../managed-postgresql/concepts/storage.md#read-only-monitor).

Upon receiving the alert, you can recover the cluster from this mode in two ways:

* [Expanding the storage size](../../../managed-postgresql/operations/storage-space.md): Managed Service for PostgreSQL will automatically disable `read-only ` mode.
* Manually by following [these steps](../../../managed-postgresql/concepts/storage.md#read-only-solutions).

Currently, there is no way to automatically expand cluster storage.