Disks
Disks are virtual counterparts of physical storage devices, such as SSDs and HDDs.
Disk enable data storage and operate connected to virtual machines. Detaching a disk does not delete its data.
Each disk is located in one of the availability zones and replicated within it (unless it is a non-replicated disk) for data protection. Disks are not replicated to other zones.
After creating a disk, you can change its name and description and increase its size.
Disks are subject to technical restrictions on reads and writes, as well as Compute Cloud quotas and limits.
Disk as a Yandex Cloud resource
A disk is created inside a folder and inherits its access permissions.
Disks take up storage space, which comes at an extra charge. For more information, see Compute Cloud pricing policy. You specify the disk size when you create a new disk. This is exactly the volume you get charged for.
If the disk is created from a snapshot or image, its information will contain the ID of its source. The license IDs (product_ids
) used to calculate the disk usage cost are also inherited from the source.
Disk types
Yandex Cloud VMs can use the following disk types:
- Network SSD (
network-ssd
): Fast network drive; SSD network block storage. - Network HDD (
network-hdd
): Standard network drive; HDD network block storage. - Non-replicated SSD (
network-ssd-nonreplicated
): Enhanced performance network drive without redundancy. - Ultra high-speed network storage with three replicas (SSD) (
network-ssd-io-m3
): High-performance SSD offering the same speed asnetwork-ssd-nonreplicated
, plus redundancy. - Local disk drives on dedicated hosts.
Network SSDs, high-performance SSDs, and network HDDs provide sufficient redundancy for reliable data storage and enable continuous read and write operations, even when multiple physical disks fail at the same time. Non-replicated disks do not ensure data durability.
If a physical disk hosting a network drive fails, the VM will continue running and will quickly regain full access to its data.
Non-replicated disks and ultra high-speed network storages with three replicas (SSD)
Non-replicated disks and high-performance SSDs (ultra high-speed network storages with three replicas) outperform network SSDs but their size must be a multiple of 93 GB.
In all calculations: 1 GB = 230 bytes, 1 MB = 220 bytes.
Alert
Our recommendation is to avoid using a non-replicated disk as your boot drive. This is because, in case it fails, your virtual machine may become unavailable.
Non-replicated disks are physically located in the server racks of the data center in one of the availability zones. Every so often the existing racks and equipment get replaced with new ones, with their data migrated from one physical medium to another.
During a migration like that, the Status line on the disk information page in the management consoledata migration in progress, slight performance decrease may be experienced
. The disk may temporarily become unavailable for write operations, and its performance may deteriorate.
If you need enhanced performance and guaranteed fault tolerance, we recommend using high-performance SSDs.
Maximum disk size
Disks consist of blocks. By default, the block size is 4 KB for all new disks. When creating a disk, you can set the block size between 4 KB and 128 KB.
For network disks, the maximum disk size depends on the block size. The size of a newly created disk must be a multiple of 4 MB. The possible disk and block sizes are as follows:
Block size | Maximum disk size |
---|---|
4 KB | 8 TB |
8 KB | 16 TB |
16 KB | 32 TB |
32 KB | 64 TB |
64 KB | 128 TB |
128 KB | 256 TB |
For non-replicated SSDs and ultra high-speed network SSD storages with three replicas, you can select any block size for any disk size. The disk size must be a multiple of 93 GB.
You cannot change the block size after the disk is created.
Alert
The selected physical block size may affect disk performance.
Typically, the logical block size is 512 bytes. Although the guest OS tries to align data I/O with the physical block size, this may not always be feasible. When the software runs numerous read and write operations that are smaller than the physical block, these operations can reach the disk subsystem. When it comes to read operations, this means reading more data than actually requested, i.e., at least one physical block. Write operations are even more complex, as to write data smaller than the physical block, the system first reads the entire physical block, then modifies specific bytes, and, finally, rewrites this block (this is known as read-modify-write operation). As long as such an operation is not aligned to the physical block size, it may require reading and rewriting two physical blocks. This can turn one logical write into two read and two write operations at the disk subsystem level. This extra load will not show up in the guest OS metrics but will affect performance and will be considered when assessing how close the load is to the disk limits.
This is why we recommend choosing large block sizes only when your software uses large requests (at least equal to the physical block size) when working with the file system or disk.
Attaching and detaching disks
You can only attach each disk to one VM at a time. Additionally, both the disk and the VM must be in the same availability zone.
A VM must have a boot disk attached. You can also attach extra disks to your VM.
On a Linux VM deployed from Cloud Marketplace or custom images with the driver kit installed, a secondary disk you attach will be available as a new device without rebooting the VM.
To successfully attach a disk, the VM operating system must be fully booted or stopped; otherwise the operation will fail. If an error occurs, stop the VM and try again.
On a Windows VM, a secondary disk you attach will only show up as a new device after a reboot.
Note
Empty disks do not have a file system. If you are attaching an empty disk, partition and mount it manually. Alternatively, rather than attaching an empty disk, you can create a snapshot of the boot disk and use it to create a VM.
When selecting a disk to attach to your VM, you can specify whether to delete that disk when deleting the VM. This option is available when you create a VM, reconfigure it, or attach a new disk to it.
If a VM had any previously created disks attached, they will be detached when you delete the VM. The data on the disk will be still there, and you will be able to attach the disk to a different VM later.
If you would like to delete a disk with a VM, specify this option when creating the VM, reconfiguring it, or attaching the disk. Such disks will be deleted along with the VM.
Backups
Backups are required to make sure no data is lost if damaged. Different disk types allow using different backup methods:
- Cloud Backup enables you to create consistent data copies on VMs with any disk types.
- Disk snapshots: Use them to manually or automatically create scheduled snapshots of network SSDs and HDDs, as well as high-performance and non-replicated SSDs. You can also use snapshots to migrate disks from one availability zone to another.
Snapshots are replicated across all availability zones, which allows you to migrate disks from one zone to another.
Sometimes, you may want to restore a disk to a specific state on a regular basis, for instance, when you need to attach the same boot drive to every new VM. In this case, you can upload a disk image to Compute Cloud, which will allow you to create disks faster than you would do it from snapshots. Images are also automatically replicated to multiple availability zones.
You cannot recover a boot disk of an existing VM from a snapshot or image. However, you can create a new VM to recover the boot disk from a snapshot. To recover the boot disk of an existing VM, use Yandex Cloud Backup.
For general recommendations on backing up and restoring VMs, see Backups in Compute Cloud.
Disk encryption
To protect critical data in Compute Cloud, we recommend encrypting disks with Yandex Key Management Service keys.
For more information, see Encryption in Compute Cloud.