Deleting a file storage
-
Detach the file storage from all the VMs it is attached to.
-
Delete the file storage in Compute Cloud:
Management consoleCLITerraformAPI- In the management console
, select the folder where your file storage resides. - Select Compute Cloud.
- In the left-hand panel, select
File storages. - In the line with the file storage, click
and select Delete. - In the window that opens, click Delete.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the
yc config set folder-id <folder_ID>command. You can also set a different folder for any specific command using the--folder-nameor--folder-idparameter.-
See the description of the CLI command for deleting a file storage:
yc compute filesystem delete --help -
Get a list of file storages in the default folder:
yc compute filesystem listResult:
+----------------------+-------------------+------------+---------------+--------+-------------+ | ID | NAME | SIZE | ZONE | STATUS | DESCRIPTION | +----------------------+-------------------+------------+---------------+--------+-------------+ | epdtcr9blled******** | first-filesystem | 1073741824 | ru-central1-a | READY | | | epd3f4gv8bs4******** | second-filesystem | 1073741824 | ru-central1-a | READY | | +----------------------+-------------------+------------+---------------+--------+-------------+ -
Run this command, specifying the name or ID of the file storage you want to delete:
yc compute filesystem delete <file_storage_name_or_ID> -
Make sure the file storage has been deleted:
yc compute filesystem list
If you do not have Terraform yet, install it and configure the Yandex Cloud provider.
-
Open the Terraform configuration file and delete the section specifying the storage:
Example of specifying a file storage in Terraform configuration
... resource "yandex_compute_filesystem" "default" { name = "fs-name" type = "network-ssd" zone = "ru-central1-a" size = 150 } ... -
Apply the changes:
-
In the terminal, go to the directory where you edited the configuration file.
-
Make sure the configuration file is correct using this command:
terraform validateIf the configuration is correct, you will get this message:
Success! The configuration is valid. -
Run this command:
terraform planYou will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.
-
Apply the changes:
terraform apply -
Type
yesand press Enter to confirm the changes.
-
You can check the storage deletion using the management console
or this CLI command:yc compute filesystem listUse the delete REST API method for the Filesystem resource or the FilesystemService/Delete gRPC API call.
- In the management console