Deleting a disk
Warning
You can only delete a disk that is not attached to a virtual machine. For instructions on detaching a disk, see Detaching a disk from a VM. Deleting a disk is an operation that cannot be canceled or reversed. You cannot restore a deleted disk.
If you delete a disk, its snapshots are not deleted with it. Snapshots need to be deleted separately.
To delete a disk:
- In the management console, select the folder the disk belongs to.
- Select Compute Cloud.
- In the left-hand panel, select
Disks. - In the line of the appropriate disk, click
and select Delete. - In the window that opens, click Delete.
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's delete disk commands:
yc compute disk delete --help
-
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 | | | | +----------------------+--------------+-------------+-------------------+--------+----------------------+-----------------+-------------+
-
Select the disk you intend to use by
ID
orNAME
. -
Delete the disk:
yc compute disk delete \ --name first-disk
If you don't have Terraform, install it and configure the Yandex Cloud provider.
You can delete disks created with Terraform:
-
In the command line, go to the directory with the Terraform configuration file.
-
Delete the resources using this command:
terraform destroy
Alert
Terraform deletes all the resources that you created in the current configuration, such as clusters, networks, subnets, and instances.
-
Type
yes
and press Enter.
To delete a disk, use the delete REST API method for the Disk resource or the DiskService/Delete gRPC API call.
To request the list of available disks, use the list REST API method or the DiskService/List gRPC API call.