The ossfs enables you to mount Alibaba Cloud OSS buckets to a local file in Linux, macOS, and FreeBSD systems. In the system, you can conveniently operate on objects in OSS while using the local file system to maintain data sharing.
The ossfs is built based on s3fs and has all the features of s3fs. Main features:
In addition to the above features, ossfs also has its own features.
We have prepared an installer package for common Linux releases:
Please select the corresponding installer on the [Version Releases Page][Releases] to download and install the tool. The latest version is recommended.
sudo apt-get update
sudo apt-get install gdebi-core
sudo gdebi your_ossfs_package
sudo yum localinstall your_ossfs_package
sudo yum localinstall your_ossfs_package
If you fail to find the corresponding installer package, you can also install the tool by compiling the code on your own. First install the following dependency libraries before compilation:
Ubuntu 14.04:
sudo apt-get install automake autotools-dev g++ git libcurl4-gnutls-dev \
libfuse-dev libssl-dev libxml2-dev make pkg-config
CentOS 7.0:
sudo yum install automake gcc-c++ git libcurl-devel libxml2-devel \
fuse-devel make openssl-devel
Then you can download the source code from GitHub and compile the code for installing the tool:
git clone https://github.com/aliyun/ossfs.git
cd ossfs
./autogen.sh
./configure
make
sudo make install
Otherwise consult the compilation instructions.
The default location for the ossfs password file can be created:
.passwd-ossfs
file in the users home directory (i.e. ${HOME}/.passwd-ossfs
)/etc/passwd-ossfs
fileEnter your credentials in a file ${HOME}/.passwd-ossfs
and set
owner-only permissions:
echo my-access-key-id:my-access-key-secret > ${HOME}/.passwd-ossfs
chmod 600 ${HOME}/.passwd-ossfs
Run ossfs with an existing bucket my-bucket
and directory /path/to/mountpoint
:
ossfs my-bucket /path/to/mountpoint -ourl=my-oss-endpoint
If you encounter any errors, enable debug output:
ossfs my-bucket /path/to/mountpoint -ourl=my-oss-endpoint -o dbglevel=info -f -o curldbg
You can also mount on boot by entering the following line to /etc/fstab
:
my-bucket /path/to/mountpoint fuse.ossfs _netdev,allow_other,url=my-oss-endpoint 0 0
Note: You may also want to create the global credential file first
echo my-access-key-id:my-access-key-secret > /etc/passwd-ossfs
chmod 600 /etc/passwd-ossfs
Note2: You may also need to make sure netfs
service is start on boot
Mount the 'my-bucket' bucket to the '/tmp/ossfs' directory and the AccessKeyId is 'faint', the AccessKeySecret is '123', and the OSS endpoint is 'http://oss-cn-hangzhou.aliyuncs.com'.
echo faint:123 > /etc/passwd-ossfs
chmod 600 /etc/passwd-ossfs
mkdir /tmp/ossfs
ossfs my-bucket /tmp/ossfs -ourl=http://oss-cn-hangzhou.aliyuncs.com
Unmount the bucket:
umount /tmp/ossfs # root user
fusermount -u /tmp/ossfs # non-root user
You can use 'ossfs --version' to view the current version and 'ossfs -h' to view available parameters.
If you are using ossfs on an Alibaba Cloud ECS instance, you can use the intranet domain name to save traffic charges and improve speed:
ossfs my-bucket /tmp/ossfs -ourl=http://oss-cn-hangzhou-internal.aliyuncs.com
In a Linux system, [updatedb][updatedb] will scan the file system on a regular basis. If you do not want the ossfs-mounted directory to be scanned, refer to [FAQ][FAQ-updatedb] to configure skipping the mounted directory.
The ossfs allows you to specify multiple sets of bucket/access_key_id/access_key_secret information. When multiple sets of information are in place, the format of the information written to passwd-ossfs is:
bucket1:access_key_id1:access_key_secret1
bucket2:access_key_id2:access_key_secret2
The [Supervisor][Supervisor] is recommended in a production environment to start and monitor the ossfs process. For usage see [FAQ][faq-supervisor].
Do not panic in case of errors. Troubleshoot the problem following the steps below:
If a printing error occurs, read and understand the error message.
View '/var/log/syslog' or '/var/log/messages' to check for any related information.
grep 's3fs' /var/log/syslog
grep 'ossfs' /var/log/syslog
Retry ossfs mounting and open the debug log:
ossfs ... -o dbglevel=debug -f -d > /tmp/fs.log 2>&1
Repeat the operation and save the '/tmp/fs.log' to check or send the file to me.
Generally OSS cannot offer the same performance or semantics as a local file system. More specifically:
Copyright (C) 2010 Randy Rizun rrizun@gmail.com
Licensed under the GNU GPL version 2