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 is located. - Select Compute Cloud.
- In the left-hand panel, select
File storages. - In the appropriate file storage row, click
and select Delete. - In the window that opens, click Delete.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
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.-
View the description of the CLI command to delete a file storage:
yc compute filesystem delete --help
-
Get a list of file storages in the default folder:
yc compute filesystem list
Result:
+----------------------+-------------------+------------+---------------+--------+-------------+ | ID | NAME | SIZE | ZONE | STATUS | DESCRIPTION | +----------------------+-------------------+------------+---------------+--------+-------------+ | epdtcr9blled******** | first-filesystem | 1073741824 | ru-central1-a | READY | | | epd3f4gv8bs4******** | second-filesystem | 1073741824 | ru-central1-a | READY | | +----------------------+-------------------+------------+---------------+--------+-------------+
-
Run the command by 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 don't have Terraform, install it and configure the Yandex Cloud provider.
-
Open the Terraform configuration file and delete the fragment with the storage description:
Sample storage description in the 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, change to the folder where you edited the configuration file.
-
Make sure the configuration file is correct using the command:
terraform validate
If the configuration is correct, the following message is returned:
Success! The configuration is valid.
-
Run the command:
terraform plan
The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.
-
Apply the configuration changes:
terraform apply
-
Confirm the changes: type
yes
in the terminal and press Enter.
-
You can check the storage deletion using the management console
or this CLI command:yc compute filesystem list
Use the delete REST API method for the Filesystem resource or the FilesystemService/Delete gRPC API call.
- In the management console