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:
- The name must be from 3 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter and the last character cannot be 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 data storage volume). By default, block size is 4 KB for all new disks; however, this is not enough for disks larger than 8 TB.
-
Specify the required disk size. The maximum disk size depends on the specified block size.
-
(Optional) To encrypt a disk, under Disks and file storages, configure encryption parameters for the disk:
- Select the Encrypted disk option.
- In the KMS Key field, select the key with which you want to encrypt the disk. To create a new key, click Create.
The encryption feature in Compute Cloud is currently at the Preview stage. To access it, open the resource creation page and click Request access under Encryption or contact support
.If you deactivate the key used to encrypt a disk 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 or snapshot, access to the data will be irrevocably lost. Learn more in Destroying key versions.
-
If required, select a schedule to create snapshots automatically or set up a new schedule. For more information about setting up schedules, see this guide.
You can create snapshots of network drives, such as HDDs, SSDs, and non-replicated SSDs, as well as ultra-high performance network storages with three replicas (SSD).
For non-replicated SSDs and ultra-high performance network storages with three replicas (SSD), the snapshot time is not determined.
To take 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 select only one 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 using the --folder-name
or --folder-id
parameter.
-
See the description of the CLI create disk commands:
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 creates a 10 GB disk named
first-disk
and described asmy first disk via yc
.The disk naming requirements are as follows:
- The name must be from 3 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter and the last character cannot be 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:
-
Describe the resource parameters in the
yandex_compute_disk
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:- The name must be from 3 to 63 characters long.
- It may contain lowercase Latin letters, numbers, and hyphens.
- The first character must be a letter and the last character cannot be a hyphen.
-
type
: Disk type. -
zone
: Availability zone. The availability zone for a disk must be the same as that of the placement group where you want to create the disk. 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 (the minimum storage size for information on the disk). By default, the block size of all created disks is 4 KB; however, this is not enough 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 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 described correctly, the terminal will display a list of created resources and their parameters. If the configuration contains any errors, Terraform will point them out.
-
-
Deploy cloud resources.
-
If the configuration does not contain any errors, run this command:
terraform apply
-
Confirm that you want to create the resources.
All the resources you need will then be created in the specified folder. You can check the new resources and their configuration 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.