> For the complete documentation index, see [llms.txt](https://docs.starrocks.io/llms.txt). This page is also available as Markdown at its `.md` URL.

# CREATE STORAGE VOLUME

CREATE STORAGE VOLUME creates a storage volume for a remote storage system. This feature is supported from v3.1.

A storage volume consists of the properties and credential information of the remote data storage. You can reference a storage volume when you create databases and cloud-native tables in a shared-data StarRocks cluster.

> **CAUTION**
>
> Only users with the CREATE STORAGE VOLUME privilege on the SYSTEM level can perform this operation.
>
> In shared-data mode, StarRocks performs a storage accessibility check for each `LOCATION` during `CREATE STORAGE VOLUME` when the FE configuration item `enable_storage_volume_access_check` is enabled (enabled by default). If this check is enabled and credential, endpoint, or network access is invalid, the statement fails immediately. You can turn off this check by disabling `enable_storage_volume_access_check`.

## Syntax[​](#syntax "Direct link to Syntax")

```sql
CREATE STORAGE VOLUME [IF NOT EXISTS] <storage_volume_name>
TYPE = { S3 | HDFS | AZBLOB | ADLS2 | GS }
LOCATIONS = ('<remote_storage_path>')
[ COMMENT '<comment_string>' ]
PROPERTIES
("key" = "value",...)

```

## Parameters[​](#parameters "Direct link to Parameters")

| **Parameter**         | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| storage_volume_name | The name of the storage volume. Please note that you cannot create a storage volume named `builtin_storage_volume` because it is used to create the builtin storage volume. For the naming conventions, see [System limits](https://docs.starrocks.io/docs/sql-reference/System_limit.md).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| TYPE                  | The type of the remote storage system. Valid values: `S3`, `HDFS`, `AZBLOB`, `ADLS2`, and `GS`. `S3` indicates AWS S3 or S3-compatible storage systems. `AZBLOB` indicates Azure Blob Storage (supported from v3.1.1 onwards). `ADLS2` indicates Azure Data Lake Storage Gen2 (supported from v3.4.1 onwards). `HDFS` indicates an HDFS cluster. `GS` indicates Google Storage (access with native SDK, supported from v3.5.1 onwards).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| LOCATIONS             | The storage locations. The format is as follows:- For AWS S3 or S3 protocol-compatible storage systems: `s3://<s3_path>`. `<s3_path>` must be an absolute path, for example, `s3://testbucket/subpath`. Note that if you want to enable the [Partitioned Prefix](#partitioned-prefix) feature for the storage volume, you can only specify the bucket name, and specifying a sub-path is not allowed.<br />- For Azure Blob Storage: `azblob://<azblob_path>`. `<azblob_path>` must be an absolute path, for example, `azblob://testcontainer/subpath`.<br />- For Azure Data Lake Storage Gen2: `adls2://<file_system_name>/<dir_name>`. Example: `adls2://testfilesystem/starrocks`.<br />- For GS with native SDK: `gs://<gs_path>`. `<gs_path>` must be an absolute path, for example, `gs://testcbucket/subpath`.<br />- For HDFS: `hdfs://<host>:<port>/<hdfs_path>`. `<hdfs_path>` must be an absolute path, for example, `hdfs://127.0.0.1:9000/user/xxx/starrocks`.<br />- For WebHDFS: `webhdfs://<host>:<http_port>/<hdfs_path>`, where `<http_port>` is the HTTP port of the NameNode. `<hdfs_path>` must be an absolute path, for example, `webhdfs://127.0.0.1:50070/user/xxx/starrocks`.<br />- For ViewFS：`viewfs://<ViewFS_cluster>/<viewfs_path>`, where `<ViewFS_cluster>` is the ViewFS cluster name. `<viewfs_path>` must be an absolute path, for example, `viewfs://myviewfscluster/user/xxx/starrocks`. |
| COMMENT               | The comment on the storage volume.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| PROPERTIES            | Parameters in the `"key" = "value"` pairs used to specify the properties and credential information to access the remote storage system. For detailed information, see [PROPERTIES](#properties).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

### PROPERTIES[​](#properties "Direct link to PROPERTIES")

The table below lists all available properties of storage volumes. Following the table are the usage instructions of these properties, categorized by different scenarios from the perspectives of [Credential information](#credential-information) and [Features](#features).

| **Property**                                                  | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| enabled                                                       | Whether to enable this storage volume. Default: `false`. Disabled storage volume cannot be referenced.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| aws.s3.region                                                 | The region in which your S3 bucket resides, for example, `us-west-2`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| aws.s3.endpoint                                               | The endpoint URL used to access your S3 bucket, for example, `https://s3.us-west-2.amazonaws.com`. \[Preview] From v3.3.0 onwards, the Amazon S3 Express One Zone storage class is supported, for example, `https://s3express.us-west-2.amazonaws.com`.Beta feature[Advice on use of Beta features](https://docs.starrocks.io/docs/introduction/maturity.md)                                                                                                                                                                                                                                                                                                                       |
| aws.s3.use_aws_sdk_default_behavior                       | Whether to use the default authentication credential of AWS SDK. Valid values: `true` and `false` (Default).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| aws.s3.use_instance_profile                                 | Whether to use Instance Profile and Assumed Role as credential methods for accessing S3. Valid values: `true` and `false` (Default).- If you use IAM user-based credential (Access Key and Secret Key) to access S3, you must specify this item as `false`, and specify `aws.s3.access_key` and `aws.s3.secret_key`.<br />- If you use Instance Profile to access S3, you must specify this item as `true`.<br />- If you use Assumed Role to access S3, you must specify this item as `true`, and specify `aws.s3.iam_role_arn`.<br />- And if you use an external AWS account, you must specify this item as `true`, and specify `aws.s3.iam_role_arn` and `aws.s3.external_id`. |
| aws.s3.access_key                                            | The Access Key ID used to access your S3 bucket.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| aws.s3.secret_key                                            | The Secret Access Key used to access your S3 bucket.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| aws.s3.iam_role_arn                                         | The ARN of the IAM role that has privileges on your S3 bucket in which your data files are stored.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| aws.s3.external_id                                           | The external ID of the AWS account that is used for cross-account access to your S3 bucket.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| aws.s3.enable_path_style_access                            | Whether to use the Path Style to access S3.<br />Valid values: `true` and `false`. Default: `false`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| azure.blob.endpoint                                           | The endpoint of your Azure Blob Storage Account, for example, `https://test.blob.core.windows.net`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| azure.blob.shared_key                                        | The Shared Key used to authorize requests for your Azure Blob Storage.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| azure.blob.sas_token                                         | The shared access signatures (SAS) used to authorize requests for your Azure Blob Storage.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| azure.adls2.endpoint                                          | The endpoint of your Azure Data Lake Storage Gen2 Account, for example, `https://test.dfs.core.windows.net`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| azure.adls2.shared_key                                       | The Shared Key used to authorize requests for your Azure Data Lake Storage Gen2e.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| azure.adls2.sas_token                                        | The shared access signatures (SAS) used to authorize requests for your Azure Data Lake Storage Gen2.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| azure.adls2.oauth2_use_managed_identity                    | Whether to use Managed Identity to authorize requests for your Azure Data Lake Storage Gen2. Default: `false`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| azure.adls2.oauth2_tenant_id                                | The Tenant ID of the Managed Identity used to authorize requests for your Azure Data Lake Storage Gen2.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| azure.adls2.oauth2_client_id                                | - For Managed Identity Authentication: The Client ID of the Managed Identity used to authorize requests for your Azure Data Lake Storage Gen2.<br />- For Workload Identity: The client ID (application ID) of the Azure AD application (user-assigned managed identity or app registration) associated with the workload identity.                                                                                                                                                                                                                                                                                                                                                |
| azure.adls2.oauth2_token_file                               | The absolute file path to the OAuth2 token file projected into the pod by the Azure Workload Identity webhook.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| gcp.gcs.service_account_email                               | The email address in the JSON file generated at the creation of the Service Account, for example, `user@hello.iam.gserviceaccount.com`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| gcp.gcs.service_account_private_key_id                    | The Private Key ID in the JSON file generated at the creation of the Service Account.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| gcp.gcs.service_account_private_key                        | The Private Key in the JSON file generated at the creation of the Service Account, for example, `-----BEGIN PRIVATE KEY----xxxx-----END PRIVATE KEY-----\n`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| gcp.gcs.impersonation_service_account                       | The Service Account that you want to impersonate if you use the impersonation-based authentication.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| gcp.gcs.use_compute_engine_service_account                | Whether to use the Service Account that is bound to your Compute Engine.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| hadoop.security.authentication                                | The authentication method. Valid values: `simple`(Default) and `kerberos`. `simple` indicates simple authentication, that is, username. `kerberos` indicates Kerberos authentication.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| username                                                      | Username used to access the NameNode in the HDFS cluster.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| hadoop.security.kerberos.ticket.cache.path                    | The path that stores the kinit-generated Ticket Cache.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| dfs.nameservices                                              | Name of the HDFS cluster.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| dfs.ha.namenodes.`<ha_cluster_name>`                          | Name of the NameNode. Multiple names must be separated by commas (,). No space is allowed in the double quotes. `<ha_cluster_name>` is the name of the HDFS service specified in `dfs.nameservices`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| dfs.namenode.rpc-address.`<ha_cluster_name>`.`<NameNode>`     | The RPC address information of the NameNode. `<NameNode>` is the name of the NameNode specified in `dfs.ha.namenodes.<ha_cluster_name>`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| dfs.client.failover.proxy.provider                            | The provider of the NameNode for client connection. The default value is `org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| fs.viewfs.mounttable.`<ViewFS_cluster>`.link./`<viewfs_path>` | The path to the ViewFS cluster to be mounted. Multiple paths must be separated by commas (,). `<ViewFS_cluster>` is the ViewFS cluster name specified in `LOCATIONS`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| aws.s3.enable_partitioned_prefix                            | Whether to enable the Partitioned Prefix feature for the storage volume. Default: `false`. For more information about this feature, see [Partitioned Prefix](#partitioned-prefix).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| aws.s3.num_partitioned_prefix                               | The number of prefixes to be created for the storage volume. Default: `256`. Valid range: \[4, 1024].                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

#### Credential information[​](#credential-information "Direct link to Credential information")

##### AWS S3[​](#aws-s3 "Direct link to AWS S3")

* If you use the default authentication credential of AWS SDK to access S3, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "aws.s3.region" = "<region>",
  "aws.s3.endpoint" = "<endpoint_url>",
  "aws.s3.use_aws_sdk_default_behavior" = "true"

  ```

* If you use IAM user-based credential (Access Key and Secret Key) to access S3, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "aws.s3.region" = "<region>",
  "aws.s3.endpoint" = "<endpoint_url>",
  "aws.s3.use_aws_sdk_default_behavior" = "false",
  "aws.s3.use_instance_profile" = "false",
  "aws.s3.access_key" = "<access_key>",
  "aws.s3.secret_key" = "<secrete_key>"

  ```

* If you use Instance Profile to access S3, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "aws.s3.region" = "<region>",
  "aws.s3.endpoint" = "<endpoint_url>",
  "aws.s3.use_aws_sdk_default_behavior" = "false",
  "aws.s3.use_instance_profile" = "true"

  ```

* If you use Assumed Role to access S3, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "aws.s3.region" = "<region>",
  "aws.s3.endpoint" = "<endpoint_url>",
  "aws.s3.use_aws_sdk_default_behavior" = "false",
  "aws.s3.use_instance_profile" = "true",
  "aws.s3.iam_role_arn" = "<role_arn>"

  ```

* If you use Assumed Role to access S3 from an external AWS account, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "aws.s3.region" = "<region>",
  "aws.s3.endpoint" = "<endpoint_url>",
  "aws.s3.use_aws_sdk_default_behavior" = "false",
  "aws.s3.use_instance_profile" = "true",
  "aws.s3.iam_role_arn" = "<role_arn>",
  "aws.s3.external_id" = "<external_id>"

  ```

##### MinIO[​](#minio "Direct link to MinIO")

If you use MinIO, set the following properties:

```sql
"enabled" = "{ true | false }",

-- For example: us-east-1
"aws.s3.region" = "<region>",

-- For example: http://172.26.xx.xxx:39000
"aws.s3.endpoint" = "<endpoint_url>",

"aws.s3.access_key" = "<access_key>",
"aws.s3.secret_key" = "<secrete_key>"

```

##### Azure Blob Storage[​](#azure-blob-storage "Direct link to Azure Blob Storage")

Creating a storage volume on Azure Blob Storage is supported from v3.1.1 onwards.

* If you use Shared Key to access Azure Blob Storage, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "azure.blob.endpoint" = "<endpoint_url>",
  "azure.blob.shared_key" = "<shared_key>"

  ```

* If you use shared access signatures (SAS) to access Azure Blob Storage, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "azure.blob.endpoint" = "<endpoint_url>",
  "azure.blob.sas_token" = "<sas_token>"

  ```

note

The hierarchical namespace must be disabled when you create the Azure Blob Storage Account.

##### Azure Data Lake Storage Gen2[​](#azure-data-lake-storage-gen2 "Direct link to Azure Data Lake Storage Gen2")

Creating a storage volume on Azure Data Lake Storage Gen2 is supported from v3.4.1 onwards.

* If you use Shared Key to access Azure Data Lake Storage Gen2, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "azure.adls2.endpoint" = "<endpoint_url>",
  "azure.adls2.shared_key" = "<shared_key>"

  ```

* If you use shared access signatures (SAS) to access Azure Data Lake Storage Gen2, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "azure.adls2.endpoint" = "<endpoint_url>",
  "azure.adls2.sas_token" = "<sas_token>"

  ```

* If you use Managed Identity to access Azure Data Lake Storage Gen2, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "azure.adls2.endpoint" = "<endpoint_url>",
  "azure.adls2.oauth2_use_managed_identity" = "true",
  "azure.adls2.oauth2_tenant_id" = "<tenant_id>",
  "azure.adls2.oauth2_client_id" = "<client_id>" 

  ```

* If you use Workload Identity to access Azure Data Lake Storage Gen2, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "azure.adls2.endpoint" = "<endpoint_url>",
  "azure.adls2.oauth2_token_file" = "<path_to_token>",
  "azure.adls2.oauth2_tenant_id" = "<service_principal_tenant_id>",
  "azure.adls2.oauth2_client_id" = "<service_client_id>"

  ```

note

Azure Data Lake Storage Gen1 is not supported.

##### Google Storage[​](#google-storage "Direct link to Google Storage")

* If you use the Service Account that is bound to your Compute Engine to access Google Storage (supported from v3.5.1), set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "gcp.gcs.use_compute_engine_service_account" = "true"

  ```

* If you use the Service Account-based authentication method to access Google Storage (supported from v3.5.1), set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "gcp.gcs.use_compute_engine_service_account" = "false",
  "gcp.gcs.service_account_email" = "<google_service_account_email>",
  "gcp.gcs.service_account_private_key_id" = "<google_service_private_key_id>",
  "gcp.gcs.service_account_private_key" = "<google_service_private_key>"

  ```

* If you use the impersonation-based authentication to access Google Storage (supported from v3.5.1), set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "gcp.gcs.use_compute_engine_service_account" = "false",
  "gcp.gcs.service_account_email" = "<google_service_account_email>",
  "gcp.gcs.service_account_private_key_id" = "<google_service_private_key_id>",
  "gcp.gcs.service_account_private_key" = "<google_service_private_key>",
  "gcp.gcs.impersonation_service_account" = "<assumed_google_service_account_email>"

  ```

* If you use S3 protocol with the IAM user-based authentication to access Google Storage, set the following properties:

  tip

  Google Storage is supported using the [XML API](https://docs.cloud.google.com/storage/docs/interoperability), and the settings use the AWS S3 syntax. In this case, you must set `TYPE` as `S3` and `LOCATIONS` to an S3 protocol-compatible storage location.

  ```sql
  "enabled" = "{ true | false }",

  -- For example: us-east1
  "aws.s3.region" = "<region>",

  -- For example: https://storage.googleapis.com
  "aws.s3.endpoint" = "<endpoint_url>",

  "aws.s3.access_key" = "<access_key>",
  "aws.s3.secret_key" = "<secrete_key>"

  ```

##### HDFS[​](#hdfs "Direct link to HDFS")

* If you do not use authentication to access HDFS, set the following properties:

  ```sql
  "enabled" = "{ true | false }"

  ```

* If you are using simple authentication (supported from v3.2) to access HDFS, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "hadoop.security.authentication" = "simple",
  "username" = "<hdfs_username>"

  ```

* If you are using Kerberos Ticket Cache authentication (supported since v3.2) to access HDFS, set the following properties:

  ```sql
  "enabled" = "{ true | false }",
  "hadoop.security.authentication" = "kerberos",
  "hadoop.security.kerberos.ticket.cache.path" = "<ticket_cache_path>"

  ```

  > **CAUTION**
  >
  > * This setting only forces the system to use KeyTab to access HDFS via Kerberos. Make sure that each BE or CN node has access to the KeyTab files. Also make sure that the **/etc/krb5.conf** file is set up correctly.
  > * The Ticket cache is generated by an external kinit tool. Make sure you have a crontab or similar periodic task to refresh the tickets.

* If your HDFS cluster is enabled for NameNode HA configuration (supported since v3.2), additionally set the following properties:

  ```sql
  "dfs.nameservices" = "<ha_cluster_name>",
  "dfs.ha.namenodes.<ha_cluster_name>" = "<NameNode1>,<NameNode2> [, ...]",
  "dfs.namenode.rpc-address.<ha_cluster_name>.<NameNode1>" = "<hdfs_host>:<hdfs_port>",
  "dfs.namenode.rpc-address.<ha_cluster_name>.<NameNode2>" = "<hdfs_host>:<hdfs_port>",
  [...]
  "dfs.client.failover.proxy.provider.<ha_cluster_name>" = "org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider"

  ```

  For more information, see [HDFS HA Documentation](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/HDFSHighAvailabilityWithNFS.html).

  * If you are using WebHDFS (supported since v3.2), set the following properties:

  ```sql
  "enabled" = "{ true | false }"

  ```

  For more information, see [WebHDFS Documentation](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/WebHDFS.html).

* If you are using Hadoop ViewFS (supported since v3.2), set the following properties:

  ```sql
  -- Replace <ViewFS_cluster> with the name of the ViewFS cluster.
  "fs.viewfs.mounttable.<ViewFS_cluster>.link./<viewfs_path_1>" = "hdfs://<hdfs_host_1>:<hdfs_port_1>/<hdfs_path_1>",
  "fs.viewfs.mounttable.<ViewFS_cluster>.link./<viewfs_path_2>" = "hdfs://<hdfs_host_2>:<hdfs_port_2>/<hdfs_path_2>",
  [, ...]

  ```

  For more information, see [ViewFS Documentation](https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/ViewFs.html).

#### Features[​](#features "Direct link to Features")

##### Partitioned Prefix[​](#partitioned-prefix "Direct link to Partitioned Prefix")

From v3.2.4, StarRocks supports creating storage volumes with the Partitioned Prefix feature for S3-compatible object storage systems. When this feature is enabled, StarRocks stores the data into multiple, uniformly prefixed partitions (sub-paths) under the bucket.

To enable this feature, set the following properties in addition to the above credential-related parameters:

```sql
"aws.s3.enable_partitioned_prefix" = "{ true | false }",
"aws.s3.num_partitioned_prefix" = "<INT>"

```

note

* The Partitioned Prefix feature is only supported for S3-compatible object storage systems, that is, the `TYPE` of the storage volume must be `S3`.
* `LOCATIONS` of the storage volume must only contain the bucket name, for example, `s3://testbucket`. Specifying a sub-path after the bucket name is not allowed.
* Both properties are immutable once the storage volume is created.
* You cannot enable this feature when create a storage volume by using the FE configuration file **fe.conf**.

## Examples[​](#examples "Direct link to Examples")

Example 1: Create a storage volume `my_s3_volume` for the AWS S3 bucket `defaultbucket`, use the IAM user-based credential (Access Key and Secret Key) to access S3, and enable it.

```sql
CREATE STORAGE VOLUME my_s3_volume
TYPE = S3
LOCATIONS = ("s3://defaultbucket/test/")
PROPERTIES
(
    "aws.s3.region" = "us-west-2",
    "aws.s3.endpoint" = "https://s3.us-west-2.amazonaws.com",
    "aws.s3.use_aws_sdk_default_behavior" = "false",
    "aws.s3.use_instance_profile" = "false",
    "aws.s3.access_key" = "xxxxxxxxxx",
    "aws.s3.secret_key" = "yyyyyyyyyy"
);

```

Example 2: Create a storage volume `my_hdfs_volume` for HDFS and enable it.

```sql
CREATE STORAGE VOLUME my_hdfs_volume
TYPE = HDFS
LOCATIONS = ("hdfs://127.0.0.1:9000/sr/test/")
PROPERTIES
(
    "enabled" = "true"
);

```

Example 3: Create a storage volume `hdfsvolumehadoop` for HDFS using simple authentication.

```sql
CREATE STORAGE VOLUME hdfsvolumehadoop
TYPE = HDFS
LOCATIONS = ("hdfs://127.0.0.1:9000/sr/test/")
PROPERTIES(
    "hadoop.security.authentication" = "simple",
    "username" = "starrocks"
);

```

Example 4: Use Kerberos Ticket Cache authentication to access HDFS and create storage volume `hdfsvolkerberos`.

```sql
CREATE STORAGE VOLUME hdfsvolkerberos
TYPE = HDFS
LOCATIONS = ("hdfs://127.0.0.1:9000/sr/test/")
PROPERTIES(
    "hadoop.security.authentication" = "kerberos",
    "hadoop.security.kerberos.ticket.cache.path" = "/path/to/ticket/cache/path"
);

```

Example 5: Create storage volume `hdfsvolha` for an HDFS cluster with NameNode HA configuration enabled.

```sql
CREATE STORAGE VOLUME hdfsvolha
TYPE = HDFS
LOCATIONS = ("hdfs://myhacluster/data/sr")
PROPERTIES(
    "dfs.nameservices" = "myhacluster",
    "dfs.ha.namenodes.myhacluster" = "nn1,nn2,nn3",
    "dfs.namenode.rpc-address.myhacluster.nn1" = "machine1.example.com:8020",
    "dfs.namenode.rpc-address.myhacluster.nn2" = "machine2.example.com:8020",
    "dfs.namenode.rpc-address.myhacluster.nn3" = "machine3.example.com:8020",
    "dfs.namenode.http-address.myhacluster.nn1" = "machine1.example.com:9870",
    "dfs.namenode.http-address.myhacluster.nn2" = "machine2.example.com:9870",
    "dfs.namenode.http-address.myhacluster.nn3" = "machine3.example.com:9870",
    "dfs.client.failover.proxy.provider.myhacluster" = "org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider"
);

```

Example 6: Create a storage volume `webhdfsvol` for WebHDFS.

```sql
CREATE STORAGE VOLUME webhdfsvol
TYPE = HDFS
LOCATIONS = ("webhdfs://namenode:9870/data/sr");

```

Example 7: Create a storage volume `viewfsvol` using Hadoop ViewFS.

```sql
CREATE STORAGE VOLUME viewfsvol
TYPE = HDFS
LOCATIONS = ("viewfs://clusterX/data/sr")
PROPERTIES(
    "fs.viewfs.mounttable.clusterX.link./data" = "hdfs://nn1-clusterx.example.com:8020/data",
    "fs.viewfs.mounttable.clusterX.link./project" = "hdfs://nn2-clusterx.example.com:8020/project"
);

```

Example 8: Create a storage volume `adls2` for Azure Data Lake Storage Gen2 using SAS token.

```sql
CREATE STORAGE VOLUME adls2
TYPE = ADLS2
LOCATIONS = ("adls2://testfilesystem/starrocks")
PROPERTIES (
    "azure.adls2.endpoint" = "https://test.dfs.core.windows.net",
    "azure.adls2.sas_token" = "xxx"
);

```

Example 9: Create a storage volume `gs` for Google Storage using impersonated Service Account.

```sql
CREATE STORAGE VOLUME gs
TYPE = GS
LOCATIONS = ("gs://testbucket/starrocks")
PROPERTIES (
    "gcp.gcs.use_compute_engine_service_account" = "false",
    "gcp.gcs.service_account_email" = "user@hello.iam.gserviceaccount.com",
    "gcp.gcs.service_account_private_key_id" = "61d257bd847xxxxxxxxxxxxxxx4f0b9b6b9ca07af3b7ea",
    "gcp.gcs.service_account_private_key" = "-----BEGIN PRIVATE KEY----xxxx-----END PRIVATE KEY-----\n",
    "gcp.gcs.impersonation_service_account" = "admin@hello.iam.gserviceaccount.com"
);

```

## Relevant SQL statements[​](#relevant-sql-statements "Direct link to Relevant SQL statements")

* [ALTER STORAGE VOLUME](https://docs.starrocks.io/docs/sql-reference/sql-statements/cluster-management/storage_volume/ALTER_STORAGE_VOLUME.md)
* [DROP STORAGE VOLUME](https://docs.starrocks.io/docs/sql-reference/sql-statements/cluster-management/storage_volume/DROP_STORAGE_VOLUME.md)
* [SET DEFAULT STORAGE VOLUME](https://docs.starrocks.io/docs/sql-reference/sql-statements/cluster-management/storage_volume/SET_DEFAULT_STORAGE_VOLUME.md)
* [DESC STORAGE VOLUME](https://docs.starrocks.io/docs/sql-reference/sql-statements/cluster-management/storage_volume/DESC_STORAGE_VOLUME.md)
* [SHOW STORAGE VOLUMES](https://docs.starrocks.io/docs/sql-reference/sql-statements/cluster-management/storage_volume/SHOW_STORAGE_VOLUMES.md)
