Volume and bucket management using ofs

When using ofs, Ozone administrators and users can perform various volume and bucket operations with the help of the Hadoop shell commands such as creating volumes and buckets and using ACLs on the volumes and buckets.

Creating volumes and buckets

Ozone administrators can create directories under the root and first-level directories using the Hadoop shell. Creating a directory under the root is equivalent to creating an Ozone volume. Creating a directory under a first-level directory is equivalent to creating a bucket. In addition, Ozone users can create buckets under volumes to which they have the write access.

In the following example, you create a volume named volume1 using the -mkdir command of the Hadoop shell:
ozone fs -mkdir ofs://ozservice1/volume1/
The equivalent Ozone command to create a volume is as follows:
ozone sh volume create o3://ozservice1/volume1/
Similarly, the Hadoop shell command for creating a bucket is as follows:
ozone fs -mkdir ofs://ozservice1/volume1/bucket1/

Using the /tmp directory

The ofs root contains a special tmp volume mount for backward compatibility with legacy Hadoop applications that use the /tmp/ directory. To use the volume mount, the Ozone administrator must first create a tmp volume and set its Access Control List (ACL) to ALL. This administrator needs to perform this process once for every cluster.

The following example shows how to create the tmp volume and assign it the required ACLs:
ozone sh volume create tmp
ozone sh volume setacl tmp -al world::a
After the administrator has created the tmp volume, each user must initialize their respective tmp bucket once. The following example shows how to initialize the tmp bucket.
ozone fs -mkdir ofs://ozservice1/tmp/

The user can then write to the /tmp/ bucket just as they would to a regular bucket.

Using ACLs on volumes and buckets

You must consider the following when setting Access Control Lists (ACLs) on Ozone volumes and buckets:
  • Setting ACLs on a first-level directory except /tmp/ is the same as setting ACLs on a volume.
  • Setting ACLs on a second-level directory is the same as setting ACLs on a bucket.
  • The ACLs on the /tmp/ directory are the same as those on the bucket from which the /tmp/ directory is mapped.
    For example, if you map ofs:///tmp/ from o3fs:///tmp/<tmp-bucket-for-current-user>/, the ACLs on ofs:///tmp/<tmp-bucket-for-current-user>/ are the same as those on o3fs:///tmp/bucket1/.
  • You cannot set ACLs on the root (/) because it is only a logical root.

Renaming volumes and buckets

The ofs file system does not support renaming of volumes and buckets. Any attempt to rename a volume or a bucket results in an exception. You can only rename directories inside a bucket.

For example, ofs supports renaming of ofs:///volume1/bucket1/dir1 to ofs:///volume1/bucket1/dir2.