Creating an empty disk
You can create an empty disk of the specified size.
-
In the management console
, select the folder where you want to create a disk. -
Select Compute Cloud.
-
In the left-hand panel, select
Disks. -
Click Create disk.
-
Enter a name for the disk. The naming requirements are as follows:
- It must be 2 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
Add a description for the disk, if required.
-
Select the availability zone the disk will be in.
-
Select the required disk type:
HDD
,SSD
,SSD IO
, orNon-replicated SSD
. -
Select the required block size (minimum storage unit on the disk). By default, the block size is 4 KB for all new disks; however, this is insufficient for disks larger than 8 TB.
-
Specify the required disk size. The maximum disk size depends on the specified block size.
-
Optionally, under Encryption:
- Select Encrypted disk.
- In the KMS key field, select the key you created earlier. To create a new key, click Create new key.
Warning
You can specify encryption settings only when creating a disk. You cannot disable or change disk encryption.
If you deactivate the key used to encrypt a disk, image, or snapshot, access to the data will be suspended until you reactivate the key.
Alert
If you destroy the key or its version used to encrypt a disk, image, or snapshot, access to the data will be irrevocably lost. For details, see Destroying key versions.
-
Select or set up a schedule for automatically creating disk snapshots, if required. For more information about setting up schedules, see this guide.
You can create snapshots of network disks and drives, such as HDDs, SSDs, and non-replicated SSDs, as well as ultra high-speed network storages with three replicas (SSD).
For non-replicated SSDs and ultra high-speed network storages with three replicas (SSD), the snapshot time is not determined.
To create snapshots of local disks residing on dedicated hosts, use Yandex Cloud Backup. This service supports Ubuntu, CentOS, CentOS Stream, and Windows Server.
When creating a disk, you can only select a single snapshot schedule. After the disk is created, you can add a few more schedules, if required, by following this guide.
-
Click Create disk.
The folder specified in the CLI profile is used by default. You can specify a different folder through the --folder-name
or --folder-id
parameter.
-
See the description of the CLI commands for creating disks:
yc compute disk create --help
-
Create a disk in the default folder:
yc compute disk create \ --name first-disk \ --size 10 \ --description "my first disk via yc"
This command will create a 10 GB disk named
first-disk
and described asmy first disk via yc
.The disk naming requirements are as follows:
- It must be 2 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
Get a list of disks in the default folder:
yc compute disk list
Result:
+----------------------+--------------+-------------+-------------------+--------+----------------------+-----------------+-------------+ | ID | NAME | SIZE | ZONE | STATUS | INSTANCE IDS | PLACEMENT GROUP | DESCRIPTION | +----------------------+--------------+-------------+-------------------+--------+----------------------+-----------------+-------------+ | a7lqgbt0bb9s******** | first-disk | 20401094656 | ru-central1-a | READY | a7lcvu28njbh******** | | | | a7lv5j5hm1p1******** | second-disk | 21474836480 | ru-central1-a | READY | | | | +----------------------+--------------+-------------+-------------------+--------+----------------------+-----------------+-------------+
Get the same list with more details in YAML format:
yc compute disk list --format yaml
Result:
- id: fhm4aq4hvq5g******** folder_id: b1gm3og7ei7a******** created_at: "2018-10-29T07:43:06Z" name: first-disk description: my first disk via yc type_id: network-hdd zone_id: ru-central1-a size: "10737418240" status: READY - id: fhmo6rdqg5fo******** folder_id: b1gm3og7ei7a******** created_at: "2018-10-29T07:33:04Z" name: second-disk description: my second disk via yc type_id: network-hdd zone_id: ru-central1-a size: "8589934592" product_ids: - f2en2dtd08b5******** status: READY source_image_id: fdvk34al8k5n******** instance_ids: - fhm5b617fjnj********
If you don't have Terraform, install it and configure the Yandex Cloud provider.
To create an empty disk:
-
Define the parameters of the
yandex_compute_disk
resource in the configuration file.Here is an example of the configuration file structure:
resource "yandex_compute_disk" "empty-disk" { name = "empty-disk" type = "network-hdd" zone = "<availability_zone>" size = <disk_size> block_size = <block_size> }
Where:
-
name
: Disk name. The name format is as follows:- It must be 2 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
type
: Disk type. -
zone
: Availability zone. The availability zone for your disk must match the zone of the placement group where you want to create it. We recommend creating disks in theru-central1-a
orru-central1-b
availability zone. -
size
: Disk size in GB. The maximum disk size depends on the specified block size. -
block_size
: Block size in bytes (minimum storage unit on the disk). By default, the block size is 4 KB for all new disks; however, this is insufficient for disks larger than 8 TB. For more information, see Creating an empty disk with a large block.
For more information about the
yandex_compute_disk
resource, see the relevant provider documentation . -
-
Make sure the configuration files are correct.
-
In the command line, go to the directory where you created the configuration file.
-
Run a check using this command:
terraform plan
If the configuration is correct, the terminal will display a list of resources to create and their parameters. If the configuration contains any errors, Terraform will point them out.
-
-
Deploy the cloud resources.
-
If the configuration does not contain any errors, run this command:
terraform apply
-
Confirm creating the resources.
All the resources you need will then be created in the specified folder. You can check the new resources and their settings using the management console
or this CLI command:yc compute disk list
-
Use the create REST API method for the Disk resource or the DiskService/Create gRPC API call.