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.
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
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.rpmaarch64 architecture:
sudo wget https://gosspublic.alicdn.com/ossfs/ossfs2_2.0.5_linux_aarch64.rpm
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 -yaarch64 architecture:
sudo yum install ossfs2_2.0.5_linux_aarch64.rpm -y
Run the following command to check if ossfs 2.0 is installed.
ossfs2 --versionNoteThe ossfs2 executable file is installed to the
/usr/local/bin/ossfs2path. If you have a custom configuration for thePATHenvironment variable, you must use the absolute path/usr/local/bin/ossfs2to run the program.
CentOS
Run the following command to download the package.
sudo wget https://gosspublic.alicdn.com/ossfs/ossfs2_2.0.5_linux_x86_64.rpmRun the following command to install ossfs 2.0.
sudo yum install ossfs2_2.0.5_linux_x86_64.rpm -yRun the following command to check if ossfs 2.0 is installed.
ossfs2 --versionNoteThe ossfs2 executable file is installed to the
/usr/local/bin/ossfs2path. If you have a custom configuration for thePATHenvironment variable, you must use the absolute path/usr/local/bin/ossfs2to run the program.
Ubuntu
Run the following command to download the package.
sudo wget https://gosspublic.alicdn.com/ossfs/ossfs2_2.0.5_linux_x86_64.debRun the following command to install ossfs 2.0.
sudo dpkg -i ossfs2_2.0.5_linux_x86_64.debRun the following command to check if ossfs 2.0 is installed.
ossfs2 --versionNoteThe ossfs2 executable file is installed to the
/usr/local/bin/ossfs2path. If you have a custom configuration for thePATHenvironment variable, you must use the absolute path/usr/local/bin/ossfs2to 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.
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**********************Set the file name and path for the ossfs 2.0 configuration file. For example, you can create the
/etc/ossfs2.conffile.sudo touch /etc/ossfs2.confEnter the mount information. The following configuration is an example of mounting an entire bucket in read-only mode.
NoteTo 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.

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
Create a directory for the mount point.
You can specify the path for the mount directory as needed. For example, create the
/tmp/ossfs2-bucketdirectory.mkdir /tmp/ossfs2-bucketMount the bucket.
The following command mounts the bucket specified in
ossfs2.confto the local/tmp/ossfs2-bucket/directory in read-only mode. To mount the bucket in read/write mode, remove the--ro=trueoption from theossfs2.confconfiguration file.ossfs2 mount /tmp/ossfs2-bucket/ -c /etc/ossfs2.confAccess 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.
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/

