How to mount a bucket on Linux with s3fs
Linux brings the advantage of having a large number of open source solutions to access the Exoscale Object Storage. One of these is s3fs.
The Object Storage is not a disk drive! Using it as a storage backend with a database or similar from multiple machines may have unintended consequences.
As prerequisite for the following documentation, you’ll have to:
Create an Object Storage Bucket, either via the portal or the CLI. You can refer to the Object Storage documentation
Create an IAM key, either via the portal or the CLI. You can refer to the IAM documentation
s3fs is supplied as a package in most Linux distributions, which makes the installation simple. Execute the following commands on a root console.
s3fs could not show the file sizes before version 1.84. If you see only 0-byte files please update your s3fs version.
Ubuntu Linux 16.04 or higher, Debian Linux 9 or higher
apt install s3fs
RHEL and CentOS 7 or newer, using EPEL:
yum install epel-release yum install s3fs-fuse
SUSE 12 and openSUSE 42.1 or newer:
zypper install s3fs
Storing your access key
Save your access key as the root user:
echo API-KEY-HERE:API-SECRET-HERE > /root/.passwd-s3fs
Also change its permissions:
chmod 0600 /root/.passwd-s3fs
Create a folder
To mount the bucket you will have to create an empty folder. This could be located in
Mount by hand
Before we add the mount point permanently you can try it by hand:
s3fs BUCKET-NAME-HERE /TARGET/DIRECTORY -o use_path_request_style -o url=https://sos-EXOSCALE-ZONE-ID.exo.io/
So, for example:
s3fs my-testbucket /mnt/sos -o use_path_request_style -o url=https://sos-at-vie-1.exo.io/
To mount the object storage automatically at system start you will have to edit the
This file is required for a correct system start. If you make a mistake your system may not boot. Make sure to read up on the restore procedure and create a backup (e.g. a snapshot) before you proceed.
Insert the following line followed by a new line character:
s3fs#BUCKET-NAME /TARGET/DIRECTORY fuse _netdev,allow_other,use_path_request_style,url=https://sos-EXOSCALE-ZONE-ID.exo.io/ 0 0
So, for example:
s3fs#my-testbucket /mnt/sos fuse _netdev,allow_other,use_path_request_style,url=https://sos-at-vie-1.exo.io/ 0 0
Now you can mount the folder: