cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to create volume using databricks cli commands

pshuk
New Contributor III

I am new to using volumes on databricks. Is there a way to create volume using CLI commands.

On the similar note, is there a way to create DBFS directories and subdirectories using single command.

for example: I want to copy file here dbfs:/FileStore/Test/Test1/ but neither Test exists nor Test1. 

how can I create both using CLI in the most efficient way?

 

TIA

1 REPLY 1

Walter_C
Databricks Employee
Databricks Employee

Creates a new volume.

The user could create either an external volume or a managed volume. An external volume will be created in the specified external location, while a managed volume will be located in the default location which is specified bythe parent schema, or the parent catalog, or the Metastore.

For the volume creation to succeed, the user must satisfy following conditions: - The caller must be a metastore admin, or be the owner of th parent catalog and schema, or have the **USE_CATALOG** privilege on the parent catalog and the **USE_SCHEMA** privilege on the parent schema. - The caller must have **CREATE VOLUME** privilege on the parent schema.

 For an external volume, following conditions also need to satisfy - The caller must have **CREATE EXTERNAL VOLUME** privilege on the external location. -There are no other tables, nor volumes existing in the specified storagelocation. - The specified storage location is not under the location of other tables, nor volumes, or catalogs or schemas.

Usage:

 databricks volumes create CATALOG_NAME SCHEMA_NAME NAME VOLUME_TYPE



As for creating DBFS directories and subdirectories, you can use the 
dbfs CLI command. Here's an example of creating the directories Test and Test1:

bash
databricks fs mkdirs dbfs:/FileStore/Test/Test1/

This command creates both the Test and Test1 directories if they do not already exist.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group