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 volume and specifying quota

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.

Creating a volume:
Command Syntax
ozone sh volume create [--namespace-quota=<quotaInNamespace>]
 [--space-quota=<quotaInBytes>] <uri>
Command Usage
  • Create volume with only space quota:
    ozone sh volume create --space–quota=<quotaInBytes> <uri>
  • Create volume with only namespace quota:
    ozone sh volume create --namespace-quota=<quotaInNamespace> <uri>
  • Create volume with both space and namespace quota:
    ozone sh volume create --namespace-quota=<quotaInNamespace> --space–quota=<quotaInBytes> <uri>
Purpose Creates a volume with the quota.
Arguments
  • --namespace-quota: Specify the number of buckets in a volume. This is an optional parameter.
  • --space-quota: Specifies the maximum size the volume can occupy in the cluster. This is an optional parameter.
  • uri: The name of the volume to create in the <prefix>://<Service ID>/<volumename> format.
Examples
ozone sh volume create --space-quota=2TB o3://ozone1/vol1
This command creates a 2 TB volume named vol1. Here, ozone1 is the Ozone Service ID.
ozone sh volume create --namespace-quota=100 o3://ozone1/vol1
This command sets the namespace quota of vol1 to 100.

Checking namespace and space quota for volume

Command Syntax
ozone sh volume info <uri>
Purpose
  • Get the quota value and usedNamespace info of the 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/vol1
  • This command gets the quota value and usedNamespace of vol1.
    {
      "metadata" : { },
      "name" : "vol1",
      "admin" : "user1",
      "owner" : "user1",
      "quotaInBytes" : 2199023255552,
      "quotaInNamespace" : 100,
      "usedNamespace" : 0,
      "creationTime" : "2023-07-10T06:04:44.284Z",
      "modificationTime" : "2023-07-10T06:05:58.505Z",
      "acls" : [ {
        "type" : "USER",
        "name" : "user1",
        "aclScope" : "ACCESS",
        "aclList" : [ "ALL" ]
      }, {
        "type" : "GROUP",
        "name" : "staff",
        "aclScope" : "ACCESS",
        "aclList" : [ "ALL" ]
      } ],
      "refCount" : 0
      }

Updating volume quota

Command Syntax
ozone sh volume setquota [-hV] [--namespace-quota=<quotaInNamespace>]
 [--space-quota=<quotaInBytes>] <uri>
Command Usage
  • Update volume with only space quota:
    ozone sh volume setquota --space-quota=<quotaInBytes> <uri>
  • Update volume with only namespace quota:
    ozone sh volume setquota --namespace-quota=<quotaInNamespace> <uri>
  • Update volume with both space and namespace quota:
    ozone sh volume setquota --namespace-quota=<quotaInNamespace> --space-quota=<quotaInBytes> <uri>
Purpose Updates the quota of the specific volume.
Arguments
  • --namespace-quota: Updates the maximum number of buckets this volume can have.
  • --space-quota: Updates 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 o3://ozone1/vol1
This command sets the vol1 namespace quota to 1000 and the space quota to 10 GB.

Clearing volume quota

Namespace
Command Syntax
ozone sh volume clrquota [-hV] [--namespace-quota] [--space-quota] <uri>
Command Usage
  • Clear volume with only space quota:
    ozone sh volume clrquota --space-quota <uri> 
  • Clear volume with only namespace quota:
    ozone sh volume clrquota --namespace-quota <uri>
  • Clear volume with both space and namespace quota:
    ozone sh volume clrquota --space-quota --namespace-quota <uri> 
Purpose
  • Clear the namespace and space quota of the volume.
Arguments
  • --namespace-quota: Clears the namespace quota of a volume.
  • --space-quota: Clears the space quota of a volume.
Example
  • ozone sh volume clrquota --namespace-quota o3://ozone1/vol1
    This command clears the namespace quota of vol1.
  • ozone sh volume clrquota --space-quota o3://ozone1/vol1
    This command clears the space quota of vol1.