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 the disk size.
Disks as a Yandex Cloud resource
Disks are created within folders and inherit their access rights.
Disks take up storage space, which incurs additional fees. For more information, see Compute Cloud pricing policy. You specify the disk size when you create it, and this is the storage capacity you will be charged for.
In case you create a disk 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.
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 of all new disks is 4 KB. You can set block size in the range from 4 KB to 128 KB when creating a disk.
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.
In most cases, the logical block size is equal to 512 bytes. Although the OS tries to align data I/O with the physical block size, this might not always be possible. In case the software performs many read/write operations with a size that is less than the physical block size, such small operations may 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. In case of write operations, the situation is even more complicated, as writing data with a size that is less than the physical block size requires first reading the entire physical block, then modifying the requested bytes, and, finally, rewriting 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 also be required to read and rewrite as many as two physical blocks. Thus, a single logical write operation may turn into two read and two write operations at the disk subsystem level. This extra load will not reveal itself in the guest OS metrics, but will matter when the load is compared to the disk limits and will eventually affect performance.
This is why we recommend picking large block sizes only in case 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, the connected extra disk will be available as a new device without rebooting the VM.
For the disk to be successfully connected, 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, the connected extra disk will be available as a new device only after the VM reboots.
Note
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 such a snapshot.
When selecting a disk to attach to a VM, you can specify that the disk should be deleted once you delete 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 a boot disk from a snapshot. To recover a boot disk on 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.