Updated on 2026-08-03 GMT+08:00

Creating a Parallel File System

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see API Reference.

You can call the ObsClient->createBucket API and set the BucketType parameter to POSIX to create a parallel file system. The following code shows how to create a parallel file system:

<?php

// Import the dependency library.
require 'vendor/autoload.php';
// Import the SDK code library during source code installation.
// require 'obs-autoloader.php';
// Declare the namespace.
use Obs\ObsClient;
// Create an ObsClient instance.
$obsClient = new ObsClient ( [
      //Obtain an AK/SK pair using environment variables or import the AK/SK pair in other ways. Using hard coding may result in leakage.
      //Obtain an AK/SK pair on the management console. For details, see https://support.huaweicloud.com/intl/en-us/usermanual-ca/ca_01_0003.html.
      'key' => getenv('ACCESS_KEY_ID'),
      'secret' => getenv('SECRET_ACCESS_KEY'),
      // Enter the endpoint corresponding to the bucket. CN-Hong Kong is used here as an example. Replace it with the one currently in use.
       'endpoint' => "obs.ap-southeast-1.myhuaweicloud.com",
      'signature' => 'obs'
] );
$bucketName = 'posix-bucket-name';
// Create a POSIX parallel file system.
$resp = $obsClient->createBucket ( [
       'Bucket' => $bucketName,
       // BucketType indicates the bucket type. The value can be OBJECT (common bucket) or POSIX (parallel file system). OBJECT is used by default.
       'BucketType' => 'POSIX',
       // The value of LocationConstraint must be the same as that of endpoint. CN-Hong Kong is used here as an example. Replace it with the one currently in use.
       'LocationConstraint' => "ap-southeast-1",
       // (Optional) Specify the storage class of the bucket, for example, 'StorageClass' => ObsClient::StorageClassStandard.
       // (Optional) Specify the bucket ACL, for example, 'ACL' => ObsClient::AclPrivate.
] );
printf ( "RequestId:%s\n", $resp['RequestId'] );
// Obtain the bucket storage class.
$resp = $obsClient->getBucketMetadata ( [
       'Bucket' => $bucketName
] );
$bucketType = isset($resp['BucketType']) ? $resp['BucketType'] : 'OBJECT';
printf ( "BucketType:%s\n", $bucketType );
  • The name of a parallel file system must be globally unique.
  • A parallel file system name:
    • Must be 3 to 63 characters long and start with a digit or letter. Lowercase letters, digits, hyphens (-), and periods (.) are allowed.
    • Cannot be an IP-like address.
    • Cannot start or end with a hyphen (-) or period (.).
    • Cannot contain two consecutive periods (..), for example, my..bucket.
    • Cannot contain a period (.) and a hyphen (-) adjacent to each other, for example, my-.bucket or my.-bucket.
    • Parallel file systems and common buckets share the global namespace. The name of a parallel file system cannot be the same as that of an existing bucket. A parallel file system name can contain only lowercase letters.
  • If you repeatedly create parallel file systems with the same name in the same region, no error will be reported and the parallel file system properties comply with those set in the first creation request.
  • The parallel file system created in the example is of the default ACL (private), in the OBS Standard storage class, and in the default region.
  • You can use parameter ACL to specify the bucket ACL, use StorageClass to specify the storage class of the bucket, and use LocationConstraint to specify the bucket location.
  • During parallel file system creation, if the endpoint you use corresponds to the default region CN North-Beijing1 (cn-north-1), specifying a region is not a must. If the endpoint you use corresponds to any other region, you must set the region to the one corresponding to the used endpoint. To view the valid regions, see Regions and Endpoints. For example, if the endpoint used for initialization is obs.ap-southeast-1.myhuaweicloud.com, you must set Location to ap-southeast-1 when you create a bucket. Otherwise, status code 400 will be returned.