All Products
Search
Document Center

Object Storage Service:Use hierarchical namespace

Last Updated:Jun 02, 2026

The hierarchical namespace feature organizes objects into a directory hierarchy, enabling atomic directory and object renames without listing all objects that share a prefix. Unlike the default flat namespace that simulates directories with forward slashes (/), hierarchical namespace significantly improves directory management performance.

Benefits

  • Atomic operations on directories

    In a flat namespace, applications may need to process millions of objects for a single directory-level task. With hierarchical namespace, a parent directory update is a single atomic operation that completes multiple directory-level tasks simultaneously.

  • Optimized performance

    Hierarchical namespace eliminates the need to replicate or convert data before analysis, improving directory management performance. This is critical for big data frameworks such as Hive and Spark, which write results to temporary directories and rename them after task completion. In a flat namespace, the rename often takes longer than the task itself.

Procedure

  1. Enable hierarchical namespace.

    Hierarchical namespace can only be enabled during bucket creation and cannot be disabled afterward. For more information about how to enable hierarchical namespace, see Create buckets.

  2. Perform directory operations on a hierarchical namespace bucket.

    The following table lists the methods for managing directories in a hierarchical namespace bucket.

    Implementation method

    Description

    OSS console

    Web-based management console

    Java SDK

    SDK code samples for directory operations

Usage notes

  • Supported regions

    Hierarchical namespace is available only in the following regions: US (Silicon Valley), Japan (Tokyo), UK (London), and Malaysia (Kuala Lumpur).

  • Create directories

    A directory name cannot contain consecutive forward slashes (/).

    Data cannot be written to directories. The Content-Length of a directory can be set only to 0.

    The Content-Type of a directory can be set only to application/x-directory.

  • Rename a directory or object

    A renamed directory or object cannot share a name with an existing directory or object in the same bucket.

    The parent directory in the destination path must exist. For example, to rename a directory to destfolder/examplefolder/test, the parent directory destfolder/examplefolder must exist in the bucket.

  • Delete directories

    • Recursive delete

      Deletes a directory and all its objects and subdirectories. Requires the DeleteObject permission on the directory and all its contents.

      For example, to recursively delete dest/testfolder, you need the DeleteObject permission on dest/testfolder and dest/testfolder/*.

      Important

      If a concurrent write request targets a directory during recursive deletion, the delete may fail.

    • Non-recursive delete

      Deletes empty directories only. Requires the DeleteObject permission on the target directory.

Unsupported features

The following table lists the features not supported by hierarchical namespace buckets.

Category

Description

Bucket features

  • Cross-region replication (CRR)

  • Versioning

  • Bucket inventory

  • Cross-origin resource sharing (CORS)

  • Static website hosting

  • Lifecycle rules

  • Retention policies

  • Transfer acceleration

Object features

  • Symbolic links

  • Append upload

  • Access control list (ACL) and tagging

  • Image processing (IMG)

  • Archive and Cold Archive objects

  • Callback

  • The RestoreObject operation

  • The x-oss-forbid-overwrite header

  • The response-content-* parameter in GetObject requests for directories

  • LiveChannel operations

  • The DeleteMultipleObjects operation

  • The SelectObject operation