[Yandex Cloud documentation](../../index.md) > [Yandex Managed Service for MySQL®](../index.md) > [Concepts](index.md) > Storage in Managed Service for MySQL®

# Storage in Managed Service for MySQL®



Managed Service for MySQL® allows you to use network and local storage drives for database clusters. Network disks are based on network blocks, i.e., virtual disks in the Yandex Cloud infrastructure. Local drives are physically located on the database host servers.

When creating a cluster, you can select the following disk types for data storage:

* **Network HDDs** (`network-hdd`): Most cost-effective option for clusters with low requirements for read and write performance.
* **Network SSDs** (`network-ssd`): Compromise solution: slower than local SSDs, network SSDs ensure data integrity in the event of Yandex Cloud hardware failure.
* **Non-replicated SSDs** (`network-ssd-nonreplicated`): Network disks with higher performance achieved by eliminating redundancy.

  You can only expand this type of storage in 93 GB increments.


* **Ultra high-speed network SSDs with three replicas** (`network-ssd-io-m3`): Network disks that deliver performance equivalent to non-replicated SSDs while ensuring redundancy.

  You can only increase the size of these disks in 93 GB increments.

* **Local SSDs** (`local-ssd`): Highest-performing disks.

  You can expand such a storage as follows:
  * For **Intel Broadwell** and **Intel Cascade Lake**: Only in 100 GB increments.
  * For **Intel Ice Lake** and **AMD Zen 4**: Only in 368 GB increments.

  For clusters with hosts residing in the `ru-central1-d` [availability zone](../../overview/concepts/geo-scope.md), local SSD storage is not available if using Intel Cascade Lake. 


[Block](https://en.wikipedia.org/wiki/Block_(data_storage)) size for all disk types is 4 KB.

{% note info %}

Up to 5% of disk space is reserved for system use, so the disks may have less available space than indicated when creating a cluster.


For more information about sizes and performance of different disk types, see [this Yandex Compute Cloud guide](../../compute/concepts/limits.md#compute-limits-disks).


{% endnote %}

## Selecting the disk type when creating a cluster {#storage-type-selection}

The number of hosts you can create together with a MySQL® cluster depends on the selected disk type:

* You can create a cluster only with three or more hosts when using the following disk types:

    * Local SSDs (`local-ssd`)
    * Non-replicated SSDs (`network-ssd-nonreplicated`)

   This cluster will be [highly available](high-availability.md).

   Storage on local SSDs increases your cluster costs: you pay for the cluster even if it is stopped. For more information, see the [pricing policy](../pricing.md).

* You can add any number of hosts within the [current quota](limits.md) when using the following disk types:

    * Network HDDs (`network-hdd`)
    * Network SSDs (`network-ssd`)
    * Ultra high-speed network SSDs with three replicas (`network-ssd-io-m3`)

For more information about limits on the number of hosts per cluster, see [Quotas and limits](limits.md).



## Disk encryption {#disk-encryption}

When creating or restoring a cluster from a backup, you can encrypt the storage disk with a [custom KMS key](../../kms/concepts/key.md). To encrypt a disk of an already created cluster, disable encryption, or encrypt a disk with a different key, create a backup of the cluster and restore it with the new settings.

To create an encrypted disk, you need the `kms.keys.user` [role](../../kms/security/index.md#kms-keys-user) or higher.

If you deactivate the key used to encrypt a disk, access to the data will be suspended until you reactivate the key.

{% note alert %}

If you delete the key used to encrypt a disk or its [version](../../kms/concepts/version.md), you will irrevocably lose access to your data. For more information, see [this Key Management Service guide](../../kms/concepts/version.md#version-distruct).

{% endnote %}


## Managing disk space {#manage-storage-space}

When the storage is more than 97% full, Managed Service for MySQL® automatically switches the host to `read-only` mode. Also, the `read_only = 1` system variable will be set on the master host.

In this mode, the `INSERT`, `DELETE`, and `UPDATE` queries fail with an error.

To recover a Managed Service for MySQL® cluster from read-only mode, [increase its storage size](../operations/update.md#change-disk-size).


To monitor storage utilization, [set up alerts in Yandex Monitoring](../operations/monitoring.md#monitoring-integration).


### Automatic storage expansion {#disk-size-autoscaling}

Automatic storage size increase prevents situations where the disk runs out of free space and hosts switch to read-only mode. The storage size increases upon reaching the specified threshold percentage of the total capacity. There are two thresholds:

* Scheduled expansion threshold: To schedule such an expansion, an algorithm analyzes data from the last few hours and estimates how quickly the storage is filling up. If the calculations show that the threshold will be exceeded by the start of the nearest [maintenance window](maintenance.md#maintenance-window), the system schedules a storage expansion. If a check at the maintenance start shows that the threshold was indeed exceeded, the storage size is increased.

* Immediate expansion threshold: When reached, the storage expands immediately.

You can use one or both thresholds. If you set both thresholds, make sure the immediate increase threshold is higher than the scheduled one.

Upon reaching the specified threshold, the storage will be expanded depending on the disk type:

* For network HDDs and SSDs, by the higher of the two values: 20 GB or 20% of the current disk size.
* For non-replicated SSDs and ultra high-speed network SSDs with three replicas, by 93 GB.
* For local SSDs:

    * In an **Intel Broadwell** or **Intel Cascade Lake** cluster, by 100 GB.
    * In an **Intel Ice Lake** or **AMD Zen 4** cluster, by 368 GB.


If the threshold is reached again, the storage size will increase until it reaches the specified maximum value. Then, you should increase the maximum storage size.

You can configure automatic storage expansion when [creating](../operations/cluster-create.md) or [updating a cluster](../operations/update.md). If you set the scheduled increase threshold, you also need to configure the [maintenance window](maintenance.md#maintenance-window) schedule.

{% note warning %}

* Automatic storage expansion is not supported on dedicated hosts.

* When scaling your storage, the cluster hosts will be unavailable.

* You cannot reduce the storage size.

{% endnote %}


## Use cases {#examples}

* [Syncing data from a third-party MySQL® cluster to Yandex Managed Service for MySQL® using Yandex Data Transfer](../tutorials/sync-mysql.md)
* [Creating an online store with 1C-Bitrix: Site Management](../tutorials/bitrix-shop/index.md)
* [Creating a 1C-Bitrix website](../tutorials/bitrix-website/index.md)
* [Creating an OpenCart online store](../tutorials/opencart/index.md)