Setting up S3FS with E2E Object Storage

Introduction

S3FS-Fuse is an open-source FUSE plugin and an easy-to-use utility used to mount an S3 bucket which supports major Linux distributions & MacOS.Mounting an S3 bucket as a file system will let you use all your applications to interact with the S3 bucket and to perform read/write operations on files and folder.

In this article we will learn how to configure and use s3fs to mount a bucket from E2E Object storage and copy data to it.

Prerequestie

1.Bucket created in E2E Objectstorage with necessary permission and Its access key pairs.If you have not yet started with bucket creation you can refer this article to get started up with object storage.

2.Linux or Mac OS server with Sudo access to install and configure s3fs

Step 1 : Installing s3fs-fuse on your server

s3fs is available in default repositories for CentOS, RHEL and Ubuntu systems, You can simply install it by executing following commands on your system.

Debian 9 and Ubuntu 16.04 or newer:

sudo apt install s3fs

RHEL and CentOS 7 or newer through via EPEL:

sudo yum install epel-release
sudo yum install s3fs-fuse

macOS via Homebrew:

brew cask install osxfuse
brew install s3fs

Step 2 : Creating Access Credentials File and Bucket Mountpoint

Before you run s3fs, you will need to save your E2E Object store access credentials in a file that will be used later

The default location for the s3fs password file can be created and Keys can be added with below command

touch /etc/s3cred
echo "access_key:secret_key" > /etc/s3cred

Note

Replace access_key and secret_key with your actual Bucket Access credentials.

And set Owner only permission to the file

chmod 600 /etc/s3cred

Create a directory to mount the bucket. We will use /s3 for this article to keep it simple.

mkdir /s3

Step 3 : Run s3fs command to mount the bucket

Once credentials and Mountpoints are ready,You need to Run s3fs to mount the bucket from the E2E Object storage server using the access credentials which we created.

s3fs <bucket> /s3 -o passwd_file=/etc/s3cred,use_path_request_style,url=https://objectstore.e2enetworks.net

Note

In the above command replace <bucket> with your actual bucket name

Step 4 : Verify the Bucket mountpoint

You can verify whether the bucket is actuall mounted with below command

mount | grep s3fs

You will get an output as below

s3fs on /s3 type fuse.s3fs (rw,nosuid,nodev,relatime,user_id=0,group_id=0)

Copy a file to the mounted bucket and list the bucket to verify that file exist

#touch s3fs_file
#cp s3fs_file /s3/
#s3cmd ls s3://e2e-test
2019-11-27 02:48         0   s3://e2e-test/s3fs_file

Conclusion

In this article we have shown you how to use s3fs to mount bucket from E2E storage services locally.You have now successfully configured s3fs on your server and will now be able to mount files systems and can simply use cp, mv and ls and other basic Unix commands similar to which you run on locally attached disks and interact with your buckets.