How to Mount Object Storage Container as a File System in Linux Using s3fs on EO-Lab

If you want to create a new Object Storage container, please follow this guide: How to use Object Storage on EO-Lab

To mount your Object Storage container as a file system please complete the following steps:

  1. Check if s3fs is preinstalled on your virtual machine:

whereis s3fs
s3fs: /usr/local/bin/s3fs
  1. Save your access and secret key to the .passwd-s3fs file in your home directory:

[email protected]:~$ echo access_key:secret_key>~/.passwd-s3fs

For information regarding ec2 credentials please visit this FAQ: How to Generate EC2 Credentials on EO-Lab or send a request to the support by creating a new ticket in the Helpdesk and Support.

  1. Change the permissions of the file with stored credentials:

[email protected]:~$ chmod 600 ~/.passwd-s3fs
  1. Create a folder you would like to use as a mount location for the bucket:

[email protected]:~$ mkdir directory
  1. Mount the container using s3fs (in this case it’s called “testjohn”):

[email protected]:~$ /usr/local/bin/s3fs testjohn directory -o passwd_file=~/.passwd-s3fs -o url=https://cloud.fra1-1.cloudferro.com:8080 -o use_path_request_style -o umask=0002 -o allow_other

Parameters explanation:

-o passwd file = describes the path to the file containing credentials

-o url = endpoint address of your private object storage

-o use path_request style = parameter that fixes issues with certain characters (such as dots)

-o umask = describe permissions for accessing a container (read-write-execute)

-o allow_other = to allow other users access to the container

  1. If you do not proceed with the operation as a root user, you may encounter an error an error like this:

Warning

fusermount: option allow_other only allowed if ‘user_allow_other’ is set in /etc/fuse.conf

    1. In this case, open /etc/fuse.conf file by using a text editor, e.g. nano:

[email protected]:~$ sudo nano /etc/fuse.conf

and search for the line:

# Allow non-root users to specify the allow_other or allow_root mount options.

#user_allow_other
    1. Uncomment user_allow_other by deleting # in front:

user_allow_other

Save the file.

  1. Now you may repeat the mount command.

[email protected]:~$ /usr/local/bin/s3fs testjohn directory -o passwd_file=~/.passwd-s3fs -o url=https://cloud.fra1-1.cloudferro.com:8080 -o use_path_request_style -o umask=0002 -o allow_other
  1. After that, go to the directory where your bucket is mounted and list all the data inside:

[email protected]:~$ cd directory/
[email protected]:~/directory$ ls -al
total 5
drwxrwxr-x 1 eouser eouser    0 Jan  1  1970 .
drwxr-xr-x 8 eouser eouser 4096 Oct 27 07:05 ..
-rwxrwxr-x 1 eouser eouser   15 Oct 27 07:17 tes1.txt

It found one file: tes1.txt. To check whether it actually exists, log in to your Horizon Panel and click on the Object Store tab:

../_images/mountos1.png

Select “Containers”.

../_images/mountos2.png

Then, click on the container:

../_images/mountos3.png

On the right are the files that are stored inside the bucket.