Help Center/ Object Storage Service/ Tools Guide/ obsfs/ Operation Guide/ Mounting a Parallel File System
Updated on 2026-07-29 GMT+08:00

Mounting a Parallel File System

To use OBS through obsfs, you must mount an OBS parallel file system to your local file system. Once mounted, you can operate the OBS parallel file system just like a local directory. For example, saving a file to the mount point uploads it to OBS.

When obsfs is used over the Internet to mount a parallel file system to a Huawei Cloud ECS, the traffic is billed as OBS traffic rather than ECS traffic.

Constraints

  • After an OBS parallel file system is mounted using obsfs, the newly generated mount point cannot be used as an FTP directory.
  • The actual size and used space of a parallel file system vary with your actual usage.
  • A parallel file system can be mounted to multiple cloud servers, but you need to prevent multiple servers from concurrently writing to the same file.
  • If obsfs is used to mount a parallel file system, bucket policies and IAM policies configured for the parallel file system take effect, but those configured for directories do not take effect.
  • A parallel file system that is mounted locally cannot provide the same performance and functions as an actual local file system. When using a mounted parallel file system, pay attention to the following points:
    • Files or folders in the mount point do not support hard link commands.
    • There can be no more than 45 directory levels.
    • Since there is switching between user mode and kernel mode in FUSE, obsfs is not recommended for high-concurrency scenarios.
    • Linux commands (such as ls and stat) require remote access to the OBS server, which causes poor performance.

Prerequisites

  • You have obtained obsfs by referring to Downloading and Installing obsfs.
  • obsfs has been initialized by referring to Initializing obsfs.
  • The local mount directory already exists.

    You can run the mkdir command to create a directory for mounting a parallel file system. For example, to create a directory named mountpoint, use the following command:

    mkdir mountpoint
  • The system time has been calibrated.

    If there is a large time offset between the system and the storage server, request authentication will fail.

Mounting a Parallel File System Manually

A manually mounted parallel file system must be remounted after the Linux system is restarted. You can configure the parallel file system to mount automatically at startup. For details, see Mounting a Parallel File System Automatically upon Startup.

  1. Open the CLI.
  2. Run the cd command to go to the directory where obsfs is located.
  3. Run the mount command in the following format.

    ./obsfs <parallel-file-system-name> <local-mount-directory> -o url=<region-endpoint-address> -o passwd_file=<key-file-path> -o big_writes -o max_write=131072 -o use_ino <other-mount-parameters>
    • <parallel-file-system-name>: the name of the parallel file system you want to mount

      A specific directory in a parallel file system can be mounted locally. If you mount just a directory, you can access only this directory in the parallel file system after entering the local mount directory. The mount command is as follows:

      ./obsfs <parallel-file-system-name>:/<directory-name> <local-mount-directory> -o url=<region-endpoint-address> -o passwd_file=<key-file-path> -o big_writes -o max_write=131072 -o use_ino <other-mount-parameters>

    • <local-mount-directory>: the absolute or relative path of the directory where the parallel file system is to be mounted
    • <region-endpoint-address>: Obtain the endpoint address according to the region where the parallel file system to be mounted resides. For details, see Regions and Endpoints.
    • Mount parameters

      Mount parameters, except for passwd_file and use_ino, are optional. Choose appropriate parameters based on your actual needs. The format is -o parameter-name=parameter-value. If a parameter does not require a value, use only -o parameter-name. Table 1 describes the OBS mount parameters.

      To learn more about obsfs mount parameter settings, run the ./obsfs --help command.

      Table 1 obsfs mount parameters

      Parameter

      Type

      Mandatory

      Description

      passwd_file

      String

      Yes

      Definition

      A string parameter that specifies the path to the key file. When obsfs is in use, the system retrieves the AK and SK information from this path to verify the user's identity. Set this parameter to the key file path configured in Initializing obsfs.

      Constraints

      To ensure authentication information security, the file permission must be 600 (which means other group users cannot access the file) so that obsfs can read the file.

      Range

      Set this parameter to the key file path configured in Initializing obsfs.

      Default Value

      N/A

      use_ino

      Boolean Flag

      No

      Definition

      If this function is enabled, obsfs allocates the inode number. You are advised to enable this function in parallel file system scenarios.

      Constraints

      N/A

      Range

      N/A

      Default Value

      false: disabled

      big_writes

      Boolean Flag

      No

      Definition

      After the configuration, the maximum size of the cache can be modified.

      Constraints

      This parameter must be used together with the max_write parameter.

      Range

      N/A

      Default Value

      false: disabled

      max_write

      Int

      No

      Definition

      The maximum data block size of a single write request, in bytes. This parameter is valid only when big_writes is configured. The default write size is 4 KB, and 128 KB is recommended.

      Constraints

      This parameter must be used together with big_writes. Otherwise, this parameter does not take effect.

      Range

      A positive integer, in bytes. (Recommended value: 131072, that is, 128 KB.)

      Default Value

      4096 (4 KB)

      nonempty

      Boolean Flag

      No

      Definition

      This parameter allows the mount point to be a non-empty directory.

      Constraints

      N/A

      Range

      N/A

      Default Value

      false: disabled

      allow_other

      Boolean Flag

      No

      Definition

      This parameter allows other users to access the parallel file system.

      Constraints

      N/A

      Range

      N/A

      Default Value

      false: disabled

      max_background

      Int

      No

      Definition

      The maximum number of waiting requests in the background. This is a parameter of the FUSE kernel module. It is passed directly to the kernel.

      Constraints

      Only the root user can set this parameter to a value greater than the default.

      Range

      A positive integer, which varies depending on the kernel memory and the setting of /sys/fs/fuse/connections/<id>/max_background

      Default Value

      N/A

      use_path_request_style

      Boolean Flag

      No

      Definition

      Use this parameter when you access OBS using path-style (legacy API) requests.

      NOTE:

      If the value of url is an IP address (for example, url=https://192.168.1.1), this parameter must be included in the mount command. Otherwise, a domain name resolution error will occur.

      Constraints

      N/A

      Range

      N/A

      Default Value

      false: disabled

      umask

      String

      No

      Definition

      It controls what permissions are not given to all files in the parallel file system.

      NOTE:

      After umask is configured, the permissions of files under the mount point become: 777 – umask. Below gives an example of the umask setting.

      -o umask=xxx
      If umask is set to 777, all files in the parallel file system will have permissions of 000.
      If umask is set to 000, all files in the parallel file system will have permissions of 777.
      If umask is set to 002, all files in the parallel file system will have permissions of 775.

      Constraints

      N/A

      Range

      0000-0777

      Default Value

      0000

      obsfslog

      Boolean Flag

      No

      Definition

      This parameter enables the loading of log configuration parameters from the configuration file, including the log mode and level. You can change the log level without restarting the process when this parameter is enabled.

      NOTE:

      The path of the configuration file is: /etc/obsfsconfig. If you want to use this parameter, you need to manually create the configuration file path on the local host and write the content by referring to the following example and comments.

      An example of the configuration file content:

      //Log mode. The value 0 indicates that the log mode is displayed on the client. If the value is 1, the log file is generated in the following path: /var/log/obsfs, which is named after the process ID. If the value is 2, the log is written into the system log.
      dbglogmode=1
      //Log level. The value can be dbg, info, warn, err, or crit. If the log level is set to dbg or info, service details, such as the bucket name and file name, will be printed.
      dbglevel=info

      Constraints

      After adding dbglogmode=1 to the /etc/obsfsconfig file, you can enable file logging without specifying this mount parameter.

      Range

      N/A

      Default Value

      false: disabled

  4. Run the following command to check the mount result:

    df -h

    If information similar to the following is displayed, the OBS parallel file system has been successfully mounted.

    Filesystem       Size         Used       Avail      Use%      Mounted on
    obsfs            256T         0          256T       0%        /path/to/mountpoint

    The actual size and used space of a parallel file system vary with your actual usage.

    If the preceding information is not displayed, the parallel file system fails to be mounted. In this case, add the following parameters to the mount command, so that you can get the mount process and debug logs from the command output.

    -d -d -f -o f2 -o curldbg

    Then, locate the fault based on the error information. For details about how to handle common exceptions, see OBS Bucket or Parallel File System Mount Failures.

Command Example

The following examples describe how to configure parameters when mounting an OBS parallel file system. In these examples, the parallel file system is filesystem001 located in the CN-Hong Kong region, and the obsfs key file path is /etc/passwd-obsfs.

  • Mount the filesystem001 parallel file system to the /mnt/mount_path/ directory and allow the directory to be non-empty.
    ./obsfs filesystem001 /mnt/mount_path/ -o url=http://obs.ap-southeast-1.myhuaweicloud.com -o passwd_file=/etc/passwd-obsfs -o big_writes -o max_write=131072 -o nonempty -o use_ino
  • Mount the filesystem001 parallel file system to the /mnt/mount_path/ directory and set the write cache size.
    ./obsfs filesystem001 /mnt/mount_path/ -o url=http://obs.ap-southeast-1.myhuaweicloud.com -o passwd_file=/etc/passwd-obsfs -o big_writes -o max_write=131072 -o max_background=100 -o use_ino
  • Mount the filesystem001 parallel file system to the /mnt/mount_path/ directory and allow other users to access the directory.
    ./obsfs filesystem001 /mnt/mount_path/ -o url=http://obs.ap-southeast-1.myhuaweicloud.com  -o passwd_file=/etc/passwd-obsfs -o big_writes -o max_write=131072 -o allow_other -o use_ino

If the value of the url in the command is an IP address, add the -o use_path_request_style parameter to the mount command. Otherwise, a domain name resolution error will occur.

Mounting a Parallel File System Automatically upon Startup

The following uses CentOS 7 as an example to describe how to configure the parallel file system to automount at startup.

  1. Log in to the Linux server as user root.
  2. Run the following command to create a /home/startobsfs.sh script:

    vi /home/startobsfs.sh

  3. Press i to enter the editing mode, and write the following commands to the /home/startobsfs.sh script.

    #!/bin/bash
    cd <obsfs-absolute-path>
    ./obsfs <parallel-file-system-name> <local-mount-directory> -o url=<region-endpoint-address> -o passwd_file=<key-file-path> -o big_writes -o max_write=131072 -o use_ino mount-parameters

    For details about the mount command parameters, see 3 in section "Mounting a Parallel File System Manually."

  4. Press Esc and enter :wq to save and exit the script.
  5. Run the following command to grant the root user the permission to execute the script:

    chmod +x /home/startobsfs.sh

  6. Run the following command to grant the root user the permission to execute the rc.local file:

    chmod +x /etc/rc.d/rc.local

    The location of the rc.local file varies depending on the OS. In CentOS 7, the file is stored in /etc/rc.d/rc.local.

  7. Add the following command to the end of /etc/rc.d/rc.local, save the file, and exit:

    bash /home/startobsfs.sh

    If the /etc/rc.d/rc.local file contains an exit command (for example, exit 0), add the command in this step before the exit command.

  8. Restart the server and verify the mounting.

    After the server is restarted, run the following command to check whether the parallel file system is successfully mounted:

    df -h

    If you no longer want the parallel file system to automount at startup, delete the command added in 7 from rc.local.

Follow-up Procedure

Before adding, modifying, or deleting any parameters for a mounted parallel file system, you need to unmount the parallel file system and then mount it again. For details about how to unmount a parallel file system, see Unmounting a Parallel File System.