Commands for managing volumes

Depending on whether you are an administrator or an individual user, the Ozone shell commands enable you to create, delete, view, list, and update volumes. Before running these commands, you must have configured the Ozone Service ID for your cluster from the Configuration tab of the Ozone service on Cloudera Manager.

Creating a volume

Only an administrator can create a volume and assign it to a user. You must assign administrator privileges to users before they can create volumes. For more information, see Assigning administrator privileges to users.

Command Syntax
ozone sh volume create --quota=<volumecapacity> --user=<username> URI
Purpose Creates a volume and assigns it to a user.
Arguments
  • -q, quota: Specifies the maximum size the volume can occupy in the cluster. This is an optional parameter.
  • -u, user: The name of the user who can use the volume. The designated user can create buckets and keys inside the particular volume. This is a mandatory parameter.
  • URI: The name of the volume to create in the <prefix>://<Service ID>/<volumename> format.
Example
ozone sh volume create --quota=2TB --user=usr1 o3://ozone1/vol1
This command creates a 2-TB volume named vol1 for user usr1. Here, ozone1 is the Ozone Service ID.

Deleting a volume

Command Syntax
ozone sh volume delete URI
Purpose Deletes the specified volume, which must be empty.
Arguments URI: The name of the volume to delete in the <prefix>://<Service ID>/<volumename> format.
Example
ozone sh volume delete o3://ozone1/vol2
This command deletes the empty volume vol2. Here, ozone1 is the Ozone Service ID.

Viewing volume information

Command Syntax
ozone sh volume info URI
Purpose Provides information about the specified volume.
Arguments URI: The name of the volume whose details you want to view, in the <prefix>://<Service ID>/<volumename> format.
Example
ozone sh volume info o3://ozone1/vol3
This command provides information about the volume vol3. Here, ozone1 is the Ozone Service ID.

Listing volumes

Command Syntax
ozone sh volume list --user <username> URI
Purpose Lists all the volumes owned by the specified user.
Arguments
  • -u, user: The name of the user whose volumes you want to list.
  • URI: The Service ID of the cluster in the <prefix>://<Service ID>/ format.
Example
ozone sh volume list --user usr2 o3://ozone1/
This command lists the volumes owned by user usr2. Here, ozone1 is the Ozone Service ID.

Updating a volume

Command Syntax
ozone sh volume setquota --namespace-quota <namespacecapacity> --space-quota <volumecapacity> URI 
Purpose Updates the quota of the specific volume.
Arguments
  • --namespace-quota <namespacecapacity>: Specifies the maximum number of buckets this volume can have.
  • --space-quota <volumecapacity>: Specifies the maximum size the volume can occupy in the cluster.
  • URI: The name of the volume to update in the <prefix>://<Service ID>/<volumename> format.
Example
ozone sh volume setquota --namespace-quota 1000 --space-quota 10GB /volume1
This command sets volume1 namespace quota to 1000 and space quota to 10GB.

Setting volume Space level quota

Command Syntax
ozone sh volume setquota --space-quota <volumecapacity> /volume
Purpose Manage the quota of the specific volume.
Arguments
  • --space-quota <volumecapacity>: Specifies the maximum size the volume can occupy in the cluster.
Example
ozone sh volume setquota --space-quota 10GB /volume1
This command sets volume1 space quota to 10GB.

Clearing volume Space level quota

Command Syntax
ozone sh volume clrquota --space-quota /volume
Purpose Clear the space quota of the volume.
Arguments --space-quota: Specifies the space quota of a Volume.
Example
ozone sh volume clrquota --space-quota /volume1
This command clears the space quota of Volume1.

Check space level quota for volume

Command Syntax
ozone sh volume info /volume
Purpose Get the quota value and usedBytes info of the volume.
Arguments -
Example
ozone sh volume info /volume1
This command gets the quota value and usedBytes info of volume1.

Setting Namespace quota

Namespace quota is a number that represents how many unique names can be used. This number cannot be greater than LONG.MAX_VALUE in Java.

Command Syntax
ozone sh volume create --namespace-quota <volumecapacity> /volume
Purpose Manage the quota of the namespace volume.
Arguments --namespace-quota <volumecapacity>: Specifies the namespace quota of a Volume.
Example
ozone sh volume create --namespace-quota 100 /volume1
This command sets the namespace quota of Volume1 to 100.

Clearing volume spacelvel quota

Command Syntax
ozone sh volume clrquota --namespace-quota /volume
Purpose Clear the namespace quota of the volume.
Arguments --namespace-quota: Specifies the namespace quota of a Volume.
Example
ozone sh volume clrquota --namespace-quota /volume1
This command clears the namespace quota of Volume1.

Check Namespace level quota for volume

Command Syntax
ozone sh volume info /volume
Purpose Get the quota value and usedNamespace info of the volume.
Arguments -
Example
ozone sh volume info /volume1
This command gets the quota value and usedNamespace of volume1.