All Products
Search
Document Center

Object Storage Service:Use ossfs to mount an OSS bucket to a Linux system

Last Updated:Jan 14, 2026

Learn how to mount Object Storage Service (OSS) buckets to a local Linux system using ossfs. This approach allows applications to access objects in OSS using file system operations, such as open and read. ossfs automatically converts these operations into OSS API calls.

Note

ossfs is available in two versions: 1.0 and 2.0. Version 2.0 is re-architected for modern, compute-intensive applications. It offers significant performance upgrades but has some limitations on POSIX semantics and is the primary version for future development. We recommend ossfs 2.0 for applications such as AI training, inference, or autonomous driving simulation, especially if you prefer not to use OSS SDKs or the OSS Connector for AI/ML to accelerate model training. In contrast, ossfs 1.0 provides more comprehensive support for POSIX semantics and is suitable for daily use in scenarios that do not have high performance requirements.

Prerequisites

Operating environment

ossfs 2.0 is based on Filesystem in Userspace (FUSE).

Operating system

Version

System architecture

Kernel version

CentOS

CentOS 7

x86_64

3.10

CentOS 8

x86_64

4.18

Alibaba Cloud Linux

Alibaba Cloud Linux 2

x86_64

4.19

Alibaba Cloud Linux 3

x86_64

5.10

aarch64

5.10

Ubuntu

Ubuntu 20.04

x86_64

5.4

Ubuntu 22.04

x86_64

5.15

Ubuntu 24.04

x86_64

6.8

Install ossfs 2.0

Alibaba Cloud Linux

  1. Run the command for your system architecture to download the package.

    • x86_64 architecture: sudo wget https://gosspublic.alicdn.com/ossfs/ossfs2_2.0.5_linux_x86_64.rpm

    • aarch64 architecture: sudo wget https://gosspublic.alicdn.com/ossfs/ossfs2_2.0.5_linux_aarch64.rpm

  2. Run the command for your system architecture to install ossfs 2.0.

    • x86_64 architecture: sudo yum install ossfs2_2.0.5_linux_x86_64.rpm -y

    • aarch64 architecture: sudo yum install ossfs2_2.0.5_linux_aarch64.rpm -y

  3. Run the following command to check if ossfs 2.0 is installed.

    ossfs2 --version
    Note

    The ossfs2 executable file is installed to the /usr/local/bin/ossfs2 path. If you have a custom configuration for the PATH environment variable, you must use the absolute path /usr/local/bin/ossfs2 to run the program.

CentOS

  1. Run the following command to download the package.

    sudo wget https://gosspublic.alicdn.com/ossfs/ossfs2_2.0.5_linux_x86_64.rpm
  2. Run the following command to install ossfs 2.0.

    sudo yum install ossfs2_2.0.5_linux_x86_64.rpm -y
  3. Run the following command to check if ossfs 2.0 is installed.

    ossfs2 --version
    Note

    The ossfs2 executable file is installed to the /usr/local/bin/ossfs2 path. If you have a custom configuration for the PATH environment variable, you must use the absolute path /usr/local/bin/ossfs2 to run the program.

Ubuntu

  1. Run the following command to download the package.

    sudo wget https://gosspublic.alicdn.com/ossfs/ossfs2_2.0.5_linux_x86_64.deb
  2. Run the following command to install ossfs 2.0.

    sudo dpkg -i ossfs2_2.0.5_linux_x86_64.deb
  3. Run the following command to check if ossfs 2.0 is installed.

    ossfs2 --version
    Note

    The ossfs2 executable file is installed to the /usr/local/bin/ossfs2 path. If you have a custom configuration for the PATH environment variable, you must use the absolute path /usr/local/bin/ossfs2 to run the program.

Configure ossfs 2.0

To use ossfs, you must create a configuration file that contains your bucket information and access credentials. You can then reference this file when you mount a bucket.

  1. Create an AccessKey pair for a Resource Access Management (RAM) user that has OSS management permissions.

    Use ROS scripts to quickly create a RAM user with permissions to manage OSS and its AccessKey pair

    1. Go to the Create Stack page of the Resource Orchestration Service (ROS) console. In the Security Confirmation section, select the check box. Then, click Create.

      1.png

    2. Copy the newly created AccessKey pair on the Outputs tab after you create the RAM resources.

      image

  2. Configure the environment variables for the credentials that are used to access OSS.

    export OSS_ACCESS_KEY_ID=LTAI******************
    export OSS_ACCESS_KEY_SECRET=8CE4**********************
  3. Set the file name and path for the ossfs 2.0 configuration file. For example, you can create the /etc/ossfs2.conf file.

    sudo touch /etc/ossfs2.conf
  4. Enter the mount information. The following configuration is an example of mounting an entire bucket in read-only mode.

    Note

    To obtain the endpoint for a bucket, go to the Buckets page. Select the target bucket. In the left-side navigation pane, click Overview. On the Overview page, find the region in the Port section. The following figure shows an example for a bucket in the China (Hangzhou) region.

    image

    Open the ossfs 2.0 configuration file that you created. Configure the file based on the following example, which uses an internal Endpoint in the China (Hangzhou) region, and then save the file. To ensure faster and more stable data transmission, mount buckets from instances that are in a VPC in the same region using an internal or OSS accelerator Endpoint. Do not use a public Endpoint to access ossfs because high latency and unstable internet connectivity can cause stuttering.

    # The Endpoint of the region where the bucket is located
    --oss_endpoint=https://oss-cn-hangzhou-internal.aliyuncs.com
    
    # The bucket name
    --oss_bucket=bucketName
    
    # Mount in read-only mode
    --ro=true

Mount and access

  1. Create a directory for the mount point.

    You can specify the path for the mount directory as needed. For example, create the /tmp/ossfs2-bucket directory.

    mkdir /tmp/ossfs2-bucket
  2. Mount the bucket.

    The following command mounts the bucket specified in ossfs2.conf to the local /tmp/ossfs2-bucket/ directory in read-only mode. To mount the bucket in read/write mode, remove the --ro=true option from the ossfs2.conf configuration file.

    ossfs2 mount /tmp/ossfs2-bucket/ -c /etc/ossfs2.conf 
  3. Access the mounted bucket.

    After the bucket is mounted, you can access the objects in the bucket in the same way that you access local files. For example, run the sudo ls -lh /tmp/ossfs2-bucket/ command to list the files in the mounted bucket.

    image

  4. Unmount the bucket.

    If you no longer need the bucket to be mounted, run the following command to unmount it.

    sudo umount /tmp/ossfs2-bucket/ 

References