[Yandex Cloud documentation](../../../index.md) > [Yandex Compute Cloud](../../index.md) > [Step-by-step guides](../index.md) > File storages > Creating a file storage

# Creating a file storage


To create a [file storage](../../concepts/filesystem.md):

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder) where you want to create a file storage.
  1. Navigate to **Compute Cloud**.
  1. In the left-hand panel, select ![image](../../../_assets/console-icons/nodes-right.svg) **File storages**.
  1. Click **Create file storage**.
  1. Enter a name for the file storage.

     * The name must be from 3 to 63 characters long.
     * It may contain uppercase and lowercase Latin and Cyrillic letters, numbers, hyphens, underscores, and spaces.
     * The first character must be a letter. The last character cannot be a hyphen, underscore, or space.

  1. Optionally, provide a description for file storage.
  1. Select the [availability zone](../../../overview/concepts/geo-scope.md). You can only attach a file storage to [VMs](../../concepts/vm.md) from the same availability zone.
  1. Select the [file storage type](../../concepts/filesystem.md#types).

     {% note warning %}

     Once a file storage is created, you cannot change its availability zone or type.

     {% endnote %}

  1. Specify the block and disk size for the file storage.
  1. Click **Create**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. See the description of the [CLI](../../../cli/index.md) command for creating a file storage:

      ```bash
      yc compute filesystem create --help
      ```

  1. Create a file storage in the default [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder):

      ```bash
      yc compute filesystem create \
        --name <file_storage_name> \
        --type <file_storage_type> \
        --zone <availability_zone> \
        --size <file_storage_size> \
        --labels <key>=<value>
      ```

      Where:
      * `--name`: File storage name. The naming requirements are as follows:

        * Length: between 3 and 63 characters.
        * It can only contain lowercase Latin letters, numbers, and hyphens.
        * It must start with a letter and cannot end with a hyphen.

      * `--type`: [File storage type](../../concepts/filesystem.md#types). The possible values are `network-hdd` or `network-ssd`.
      * `--zone`: [Availability zone](../../../overview/concepts/geo-scope.md).
      * `--size`: File storage size. This is an optional setting. The default value is 150 GB.

        By default, the value is specified in bytes. To specify the size in megabytes or gigabytes, use the `M` and `G` suffixes, e.g., `2048M` or `2G`.

      * `--labels`: File storage [labels](../../../resource-manager/concepts/labels.md) in `<key>=<value>` format. This is an optional setting.

        To specify multiple labels, list them separated by commas: `<key_1>=<value_1>,<key_2>=<value_2>,...,<key_n>=<value_n>`.

      Result:

      ```yml
      done (11s)
      id: epdcago8e5lr********
      folder_id: b1gt6g8ht345********
      created_at: "2024-05-02T05:56:39Z"
      name: my-sample-fs
      labels:
        key1: value1
        key2: value2
        key3: value3
      type_id: network-hdd
      zone_id: ru-central1-a
      size: "1073741824"
      status: READY
      ```

- Terraform {#tf}

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.

  1. In the configuration file, describe the resources you want to create:

     ```hcl
     provider "yandex" {
       zone = "ru-central1-a"
     }

     resource "yandex_compute_filesystem" "default" {
       name   = "<file_storage_name>"
       type   = "<file_storage_type>"
       zone   = "<availability_zone>"
       size   = <file_storage_size>
       labels = {
         <label_1_key> = "<label_1_value>"
         <label_2_key> = "<label_2_value>"
       }
     }
     ```

     Where:
     * `name`: File storage name. This is a required setting.
     * `type`: [File storage type](../../concepts/filesystem.md#types). The possible values are `network-hdd` or `network-ssd`. The default file storage type is `network-hdd`. This is an optional setting.
     * `zone`: [Availability zone](../../../overview/concepts/geo-scope.md). This is an optional setting.
     * `size`: File storage size in GB. This is an optional setting. The default value is 150 GB.
     * `labels`: Resource [label](../../../resource-manager/concepts/labels.md) in `<key> = "<value>"` format. This is an optional setting.

      For more information about `yandex_compute_filesystem` properties in Terraform, see [this provider guide](../../../terraform/resources/compute_filesystem.md).
  1. Create the resources:

     1. In the terminal, navigate to the configuration file directory.
     1. Make sure the configuration is correct using this command:
     
        ```bash
        terraform validate
        ```
     
        If the configuration is valid, you will get this message:
     
        ```bash
        Success! The configuration is valid.
        ```
     
     1. Run this command:
     
        ```bash
        terraform plan
        ```
     
        You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.
     1. Apply the configuration changes:
     
        ```bash
        terraform apply
        ```
     
     1. Type `yes` and press **Enter** to confirm the changes.

  This will create a file storage in the specified [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder). You can check the new file storage and its settings using the [management console](https://console.yandex.cloud) or this [CLI](../../../cli/index.md) command:

  ```bash
  yc compute filesystem get <file_storage_name>
  ```

- API {#api}

  Use the [create](../../api-ref/Filesystem/create.md) REST API method for the [Filesystem](../../api-ref/Filesystem/index.md) resource or the [FilesystemService/Create](../../api-ref/grpc/Filesystem/create.md) gRPC API call.

{% endlist %}