Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Managed Service for PostgreSQL
  • Getting started
    • All guides
      • Getting information on existing clusters
      • Creating a cluster
      • Updating cluster settings
      • Stopping and starting a cluster
      • Managing PostgreSQL hosts
      • Migrating hosts to a different availability zone
      • Managing replication slots
      • Managing backups
      • Managing backup policies
      • Managing disk space
      • Maintenance
      • Updating the PostgreSQL version
      • Deleting a cluster
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Set up alerts in Yandex Monitoring
  • Manually disable read-only mode for the cluster
  • Changing the disk type and increasing the storage size
  • Setting up storage autoscaling
  1. Step-by-step guides
  2. Clusters
  3. Managing disk space

Managing disk space

Written by
Yandex Cloud
Updated at December 29, 2025
  • Set up alerts in Yandex Monitoring
  • Manually disable read-only mode for the cluster
  • Changing the disk type and increasing the storage size
  • Setting up storage autoscaling

When the storage usage exceeds 97%, the host automatically switches to read-only mode.
To prevent issues with database write operations, use one of the following methods:

  • Set up alerts in Yandex Monitoring to monitor storage utilization.

  • Manually disable read-only mode for the cluster and free up the storage space by deleting non-essential data.

  • Increase the storage size to automatically disable read-only mode. You can also change the disk type.

  • Set up storage autoscaling.

Set up alerts in Yandex MonitoringSet up alerts in Yandex Monitoring

  1. Go to Monitoring.

  2. Select Managed Service for PostgreSQL.

  3. Create a notification channel.

  4. Create an alert with the following settings:

    1. Metrics: Configure the following metric settings:

      • Cloud

      • Folder

      • Managed Service for PostgreSQL service

      • Managed Service for PostgreSQL cluster ID

        You can get the cluster ID from the folder’s cluster list.

      • disk.free_bytes label

    2. Alert condition: Define the Less than or equals condition for disk usage percentage that will trigger the alert:

      • Aggregation function: Minimum (metric’s minimum value over the period).
      • Warning: 90 (90% of the storage size).
      • Alarm: 95 (95% of the storage size).
      • Evaluation window: Preferred metric update period.
    3. Add the notification channel you created earlier.

Manually disable read-only mode for the clusterManually disable read-only mode for the cluster

Alert

Take measures to prevent free disk space from being fully depleted during the following operations. Otherwise, with the fail-safe mechanism disabled, PostgreSQL will crash, rendering the cluster inoperable.

To disable read-only mode:

  1. Connect to the database using your preferred method.

  2. Start a transaction and run the following statement within it:

    SET LOCAL transaction_read_only TO off;
    
  3. In the same transaction, clean up the data you no longer need using the DROP or TRUNCATE statements. Avoid the DELETE statement because it marks rows as deleted without physically purging them from the database.

  4. Commit the transaction and restart all database connections.

For example, to remove the ExcessDataTable1 table you no longer need, use the following transaction:

BEGIN;
SET LOCAL transaction_read_only TO off;
DROP TABLE ExcessDataTable1;
COMMIT;

Changing the disk type and increasing the storage sizeChanging the disk type and increasing the storage size

Note

Some PostgreSQL settings depend on the storage size.

Make sure the cloud has enough quota to increase the storage size. Open the cloud's Quotas page and check the HDD storage capacity and SSD storage capacity lines under Managed Databases to make sure there is available quota for storage space.

Warning

  • You cannot reduce the storage size.
  • When using local disks (local-ssd), cluster hosts will be unavailable while the storage is being resized.
Management console
CLI
Terraform
REST API
gRPC API

To change the disk type and increase the storage size for a cluster:

  1. Go to Managed Service for PostgreSQL.

  2. Select your cluster and click Edit in the top panel.

  3. Under Storage size:

    • Select the disk type.
    • Specify the disk size.
  4. Click Save changes.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To change the disk type and increase the storage size for a cluster:

  1. See the description of the CLI command for updating a cluster:

    yc managed-postgresql cluster update --help
    
  2. Specify the disk type and the storage size in the cluster update command. The storage size must not be less than the disk_size value in the cluster settings:

    yc managed-postgresql cluster update <cluster_name_or_ID> \
        --disk-type <disk_type> \
        --disk-size <storage_size_in_GB>
    

To change the disk type and increase the storage size for a cluster:

  1. Open the current Terraform configuration file describing your infrastructure.

    To learn how to create this file, see Creating a cluster.

    For a complete list of configurable Managed Service for PostgreSQL cluster fields, refer to the Terraform provider guides.

  2. In the Managed Service for PostgreSQL cluster description, update the disk_type_id and disk_size attributes in the config.resources block:

    resource "yandex_mdb_postgresql_cluster" "<cluster_name>" {
      ...
      config {
        resources {
          disk_type_id = "<disk_type>"
          disk_size    = <storage_size_in_GB>
          ...
        }
      }
    }
    
  3. Validate your configuration.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm resource changes.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

    Timeouts

    The Terraform provider sets the following timeouts for Managed Service for PostgreSQL cluster operations:

    • Creating a cluster, including restoration from a backup: 30 minutes.
    • Updating a cluster: 60 minutes.
    • Deleting a cluster: 15 minutes.

    Operations exceeding the timeout are aborted.

    How can I change these timeouts?

    Add a timeouts section to the cluster description, e.g.:

    resource "yandex_mdb_postgresql_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    
  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the Cluster.Update method, for instance, via the following cURL request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
      --request PATCH \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-postgresql/v1/clusters/<cluster_ID>' \
      --data '{
                "updateMask": "configSpec.resources.diskTypeId,configSpec.resources.diskSize",
                "configSpec": {
                  "resources": {
                    "diskTypeId": "<disk_type>",
                    "diskSize": "<storage_size_in_bytes>"
                  }
                }
              }'
    

    Where:

    • updateMask: Comma-separated string of settings you want to update.

    • configSpec.resources: Storage settings:

      • diskTypeId: Disk type.
      • diskSize: New storage size in bytes.

    You can get the cluster ID from the folder’s cluster list.

  3. Check the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Call the ClusterService.Update method, for instance, via the following gRPCurl request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/postgresql/v1/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "update_mask": {
              "paths": [
                "config_spec.resources.disk_type_id",
                "config_spec.resources.disk_size"
              ]
            },
            "config_spec": {
              "resources": {
                "disk_type_id": "<disk_type>",
                "disk_size": "<storage_size_in_bytes>"
              }
            }
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.postgresql.v1.ClusterService.Update
    

    Where:

    • update_mask: List of settings you want to update as an array of strings (paths[]).

    • config_spec.resources: Storage settings:

      • disk_type_id: Disk type.
      • disk_size: New storage size in bytes.

    You can get the cluster ID from the folder’s cluster list.

  4. Check the server response to make sure your request was successful.

Setting up storage autoscalingSetting up storage autoscaling

Note

Some PostgreSQL settings depend on the storage size.

Make sure the cloud has enough quota to increase the storage size. Open the cloud's Quotas page and check the HDD storage capacity and SSD storage capacity lines under Managed Databases to make sure there is available quota for storage space.

Warning

  • You cannot reduce the storage size.
  • When using local disks (local-ssd), cluster hosts will be unavailable while the storage is being resized.
Management console
CLI
Terraform
REST API
gRPC API
  1. Go to Managed Service for PostgreSQL.

  2. Select your cluster and click Edit in the top panel.

  3. Under Automatic increase of storage size:

    1. In the Increase size field, specify the storage usage percentage that will trigger storage increase. You can configure scaling rules to trigger:

      • At the next maintenance window.
      • Immediately.

      You can set both thresholds, provided that the threshold for immediate scaling is higher than that for scaling during the maintenance window.

      To learn more about storage scaling rules, see this section.

    2. In the Maximum storage size field, specify the maximum storage size that can be set during automatic scaling.

  4. Click Save changes.

If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.

To set up storage autoscaling:

  1. See the description of the CLI command for updating a cluster:

    yc managed-postgresql cluster update --help
    
  2. In the cluster update command, specify the maximum storage size and the conditions for autoscaling.

    Make sure the maximum storage size is greater than the disk_size cluster setting. The storage usage percentage triggering an immediate increase should be higher than the percentage scheduling an increase for the next maintenance window.

    yc managed-postgresql cluster update <cluster_ID_or_name> \
        --disk-size-autoscaling disk-size-limit=<maximum_storage_size_in_bytes>,`
                               `planned-usage-threshold=<scheduled_increase_percentage>,`
                               `emergency-usage-threshold=<immediate_increase_percentage>
    

    If you have configured storage scaling during a maintenance window, set the maintenance schedule.

    To learn more about storage scaling rules, see this section.

  1. Open the current Terraform configuration file describing your infrastructure.

    To learn how to create this file, see Creating a cluster.

    For a complete list of configurable Managed Service for PostgreSQL cluster fields, refer to the Terraform provider guides.

  2. Add the disk_size_autoscaling section to the config block:

      resource "yandex_mdb_postgresql_cluster" "<cluster_name>" {
        ...
        config {
          ...
          disk_size_autoscaling {
            disk_size_limit           = <maximum_storage_size_GiB>
            emergency_usage_threshold = <threshold_for_immediate_increase_in_percent>
            planned_usage_threshold   = <threshold_for_scheduled_increase_in_percent>
          }
          ...
        }
        ...
      }
    

    Where:

    • disk_size_limit: Maximum storage capacity after expansion, in GB.

    • emergency_usage_threshold: Storage usage percentage threshold triggering an immediate storage expansion. This is an optional setting. The default value is 0 (autoscale disabled).

      Values for this setting can range from 0 to 100.

    • planned_usage_threshold: Storage usage percentage threshold triggering a storage expansion during the next maintenance window. This is an optional setting. The default value is 0 (autoscale disabled).

      Values for this setting can range from 0 to 100.

    For more information on storage scaling rules, see this section.

    Warning

    If you specify both thresholds, make sure emergency_usage_threshold is greater than or equal to planned_usage_threshold.

  3. If you specified planned_usage_threshold, configure the maintenance schedule.

  4. Validate your configuration.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  5. Confirm resource changes.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

    Timeouts

    The Terraform provider sets the following timeouts for Managed Service for PostgreSQL cluster operations:

    • Creating a cluster, including restoration from a backup: 30 minutes.
    • Updating a cluster: 60 minutes.
    • Deleting a cluster: 15 minutes.

    Operations exceeding the timeout are aborted.

    How can I change these timeouts?

    Add a timeouts section to the cluster description, e.g.:

    resource "yandex_mdb_postgresql_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    
  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the Cluster.Update method, for instance, via the following cURL request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
      --request PATCH \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-postgresql/v1/clusters/<cluster_ID>' \
      --data '{
                "updateMask": "configSpec.diskSizeAutoscaling,maintenanceWindow",
                "configSpec": {
                  "diskSizeAutoscaling": {
                    "plannedUsageThreshold": "<threshold_for_scheduled_increase_in_percent>",
                    "emergencyUsageThreshold": "<threshold_for_immediate_increase_in_percent>",
                    "diskSizeLimit": "<maximum_storage_size_in_bytes>"
                  }
                },
                "maintenanceWindow": {
                  "weeklyMaintenanceWindow": {
                    "day": "<day_of_week>",
                    "hour": "<hour>"
                  }
                }
              }'
    

    Where:

    • updateMask: Comma-separated string of settings you want to update.

      Here we provide only the configSpec.diskSizeAutoscaling and maintenanceWindow settings.

    • configSpec: Cluster settings:

      • diskSizeAutoscaling: Storage autoscaling setting:

        • plannedUsageThreshold: Storage usage percentage threshold triggering a storage expansion during the next maintenance window. This is an optional setting. The default value is 0 (autoscale disabled).

          Values for this setting can range from 0 to 100.

        • emergencyUsageThreshold: Storage usage percentage threshold triggering an immediate storage expansion. This is an optional setting. The default value is 0 (autoscale disabled).

          Values for this setting can range from 0 to 100.

        • diskSizeLimit: Maximum storage capacity after expansion, in bytes.

        Warning

        • When using the plannedUsageThreshold setting, make sure to specify maintenanceWindow.

        • If you specify both thresholds, make sure emergencyUsageThreshold is greater than or equal to plannedUsageThreshold.

        For more information about storage scaling rules, see this section.

      Use a value between 0 and 100. The default value is 0 (autoscale disabled). The value of this setting must be greater than or equal to plannedUsageThreshold.

      • diskSizeLimit: Maximum storage size, in bytes, that can be set when one of the specified storage usage thresholds is met.

      To learn more about storage scaling rules, see this section.

    • maintenanceWindow: Maintenance window schedule. This setting is required only if plannedUsageThreshold is set. It contains the following subsettings:

      • day: Day of the week, in DDD format, for scheduled maintenance.
      • hour: Hour of the day, in HH format, for scheduled maintenance. The allowed values range from 1 to 24.

    You can get the cluster ID from the folder’s cluster list.

  3. Check the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and place it in an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume the repository contents are stored in the ~/cloudapi/ directory.

  3. Call the ClusterService.Update method, for instance, via the following gRPCurl request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/postgresql/v1/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "update_mask": {
              "paths": [
                "config_spec.disk_size_autoscaling",
                "maintenance_window"
              ]
            },
            "config_spec": {
              "disk_size_autoscaling": {
                "planned_usage_threshold": "<threshold_for_scheduled_increase_in_percent>",
                "emergency_usage_threshold": "<threshold_for_immediate_increase_in_percent>",
                "disk_size_limit": "<maximum_storage_size_in_bytes>"
              }
            },
            "maintenance_window": {
              "weekly_maintenance_window": {
                "day": "<day_of_week>",
                "hour": "<hour>"
              }
            }
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.postgresql.v1.ClusterService.Update
    

    Where:

    • update_mask: List of settings you want to update as an array of strings (paths[]).

      Here we provide only the config_spec.disk_size_autoscaling and maintenance_window settings.

    • config_spec: Cluster settings:

      • disk_size_autoscaling: Storage autoscaling settings:

        • planned_usage_threshold: Storage usage percentage threshold triggering a storage expansion during the next maintenance window. This is an optional setting. The default value is 0 (autoscale disabled).

          Values for this setting can range from 0 to 100.

        • emergency_usage_threshold: Storage usage percentage threshold triggering an immediate storage expansion. This is an optional setting. The default value is 0 (autoscale disabled).

          Values for this setting can range from 0 to 100.

        • disk_size_limit: Maximum storage capacity after expansion, in bytes.

        Warning

        • When using the planned_usage_threshold setting, make sure to specify maintenance_window.

        • If you specify both thresholds, make sure that emergency_usage_threshold is greater than or equal to planned_usage_threshold.

        For more information on storage scaling rules, see this section.

      To learn more about storage scaling rules, see this section.

    • maintenance_window: Maintenance window schedule. This setting is required only if planned_usage_threshold is set. It contains the following subsettings:

      • day: Day of the week, in DDD format, for scheduled maintenance.
      • hour: Hour of the day, in HH format, for scheduled maintenance. The allowed values range from 1 to 24.

    You can get the cluster ID from the folder’s cluster list.

  4. Check the server response to make sure your request was successful.

Upon reaching the specified threshold, the storage expands with the increase size depending on the disk type:

  • For network HDDs and SSDs, the increase is the larger of these two values: 20 GB or 20% of the current disk size.

  • For non-replicated SSDs and ultra-fast network SSDs with triple replication, the increase is 93 GB.

  • For local SSDs:

    • In an Intel Broadwell or Intel Cascade Lake cluster, the increase is 100 GB.
    • In Intel Ice Lake cluster, the increase is 368 GB.

If the threshold is triggered again, the storage size will automatically increase once more. This process will repeat until the storage size reaches the specified maximum. After that, you can specify a new maximum storage size manually.

Was the article helpful?

Previous
Managing backup policies
Next
Maintenance
© 2026 Direct Cursus Technology L.L.C.