aliyun / ossfs

Export s3fs for aliyun oss.
GNU General Public License v2.0
742 stars 152 forks source link

OSSFS

[Version][releases] Build Status

README of Chinese

Introduction

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.

Features

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.

Precompiled installer

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

Install by source code

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.

Run OSSFS

The default location for the ossfs password file can be created:

Enter 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

Example

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

Common settings

Advanced settings

Errors

Do not panic in case of errors. Troubleshoot the problem following the steps below:

  1. If a printing error occurs, read and understand the error message.

  2. View '/var/log/syslog' or '/var/log/messages' to check for any related information.

    grep 's3fs' /var/log/syslog
    grep 'ossfs' /var/log/syslog
  3. 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.

Limitations

Generally OSS cannot offer the same performance or semantics as a local file system. More specifically:

Frequently Asked Questions

Related

Contact us

License

Copyright (C) 2010 Randy Rizun rrizun@gmail.com

Licensed under the GNU GPL version 2