Disks are virtual versions of physical storage devices, such as SSDs and HDDs.
Disks are designed for storing data and attach to VMs. Detaching a disk doesn't delete its data.
Each disk is located in an availability zone, where it's replicated to provide data protection. Disks are not replicated to other zones.
Disks as a Yandex.Cloud resource
Disks are created in folders and inherit their access rights.
Disks take up storage space, which incurs additional fees. For more information, see Pricing for Compute Cloud. The size of a disk is specified during creation. This is the storage capacity that you're charged for.
If a disk is created from a snapshot or image, the disk information contains the ID of the source resource. In addition, the license IDs (
product_ids) are inherited from the source resource, which are used to calculate the disk use cost.
In Yandex.Cloud, there are two types of disks:
- Network SSD (
network-ssd): A fast network drive. Network block storage on an SSD.
- Network HDD (
network-hdd): A standard network drive. Network block storage on an HDD.
The availability zone affects which types of disks you can create.
Attaching and detaching disks
Disks can only be attached to one VM at a time. The disk and VM must be located in the same availability zone.
VMs require one boot disk. Additional disks can also be attached.
Empty disks do not have a file system. If you attach an empty disk, partition and mount it manually. Alternatively, instead of attaching an empty disk, you can create a snapshot of the boot disk and create a VM based on the snapshot.
When selecting a disk to attach to a VM, you can specify whether the disk should be deleted along with the VM. You can choose this option when creating a VM, updating it, or attaching a new disk to it.
If previously created disks are attached to the VM, they are detached when the VM is deleted. Disk data is preserved and the disk can be attached to other VMs in the future.
If you want to delete a disk with a VM, specify this option during one of the following operations: when creating the VM, updating it, or attaching the disk to it. The disk will be deleted when you delete the VM.
Each disk is accessible and replicated within a specific availability zone.
You can back up disks as snapshots. Snapshots are replicated across every availability zone, which lets you transfer disks between zones.
Restoring a particular disk state can become a routine operation, for example, if you want to attach the same boot disk to every new VM. You can upload an image of the disk to Compute Cloud. Disk are created faster from images than from snapshots. Images are also automatically replicated to multiple availability zones.
For general advice on backing up and restoring virtual machines, see Backups.
Read and write operations
Disks and allocation units are subject to read and write operation limits. An allocation unit is a unit of disk space allocation, in GB. The allocation unit size depends on the disk type.
The following maximum read and write operation parameters exist:
- Maximum IOPS: The maximum number of read and write operations performed by a disk per second.
- Maximum bandwidth: The total number of bytes that can be read from or written to a disk per second.
The actual IOPS value depends on the characteristics of the disk, total bandwidth, and the size of the request in bytes. Disk IOPS is determined by the following formula:
For more information about maximum possible IOPS and bandwidth values, see Quotas and limits.
To achieve maximum IOPS, we recommend performing read and write operations that are 4 KB and less. Network SSDs have much higher IOPS for read operations and process requests faster than HDDs.
To achieve the maximum possible bandwidth, we recommend performing 4 MB reads and writes.
Disk performance depends on size: the more allocation units, the higher the IOPS and bandwidth values.
For small HDDs, there's a mechanism that raises their performance to that of 1 TB disks for peak loads. When a small disk works at the basic performance level for 12 hours, it accumulates "credits for operations". These are spent automatically when the load increases (for example, when a VM starts up). Small HDDs can work at increased performance for about 30 minutes a day. "Credits for operations" can be spent all at once or in small intervals.