Mounting an Object Storage Bucket from OCI on Linux Server

In post I am going to share how to mount an Object Storage Bucket from Oracle Cloud to my Virtual Box OEL 7 server.


1) Install OEL 7 EPEL repository on OEL 7 Server
2)  Make sure that bucket you're trying to mount is in the compartment listed for S3 compatibility, by default it's a root compartment of the tenancy.

If you need to change that, settings are located under Administration->Tenancy Details->Edit Object Storage Settings

Steps to Setup

1) Install s3fs-fuse 

I have already installed Oracle EPEL repository to I can install using yum command directly.

yum install s3fs-fuse

[root@funebs122 ~]# yum install s3fs-fuse
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package s3fs-fuse.x86_64 0:1.91-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository Size
s3fs-fuse x86_64 1.91-1.el7 ol7_epel 257 k

Transaction Summary
Install 1 Package

Total download size: 257 k
Installed size: 636 k
Is this ok [y/d/N]: y
Downloading packages:
s3fs-fuse-1.91-1.el7.x86_64.rpm | 257 kB 00:00:53
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : s3fs-fuse-1.91-1.el7.x86_64 1/1
Verifying : s3fs-fuse-1.91-1.el7.x86_64 1/1

s3fs-fuse.x86_64 0:1.91-1.el7


Make sure ntp is running

NTP Installation and Configuration

[root@funebs ~]# yum -y install ntp 
[root@funebs ~]# systemctl start ntpd 
[root@funebs ~]# systemctl enable ntpd

To forcefully synchronize run below from root.

ntpdate -q

Restart the ntpd.service

 # systemctl restart ntpd.service

In somecases you might need to restart the server.

Please wait for sometime and make sure ntp is synchronized.

[root@funebs122 etc]# timedatectl
      Local time:  08:29:19 GMT
  Universal time:  08:29:19 UTC
        RTC time:  08:29:20
       Time zone: GMT (GMT, +0000)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

or check 


2) Configure Credentials

In the Oracle Cloud Infrastructure Console, click the Profile icon in the top-right corner, and select User Settings.

Click Customer Secret Keys, and then click Generate Secret Key.
Give name accordingly and save. Note the secret key as it will shown only once.

3) Save the credentials  on OEL server.

Enter your credentials in a ${HOME}/.passwd-s3fs file and set owner-only permissions:


chmod 600 ${HOME}/.passwd-s3fs

Secret Key will be displayed only once.Please note carefully. Access key we can copy any time.

4) Create a Bucket

Go to Storage and in Object Storage and create a bucket. The bucket should be private

5) Mount the bucket in OEL 7 linux server.

Run the mount by using the following command:

s3fs [bucket] [destination directory] -o endpoint=[region] -o passwd_file=${HOME}/.passwd-s3fs -o url=https://[namespace].compat.objectstorage.[region] -o nomultipart -o use_path_request_style

[bucket] = Name of bucket created
[region] = Name of region like -- ap-hyderabad-1
[namespace]== to get this details launch Cloud Console and run below command

oci os ns get

Create a directory on OEL 7 server

[root@funebs122 ~]# mkdir /rman

Now we can mount

[root@funebs122 ~]# s3fs RMAN_BACKUP /rman -o passwd_file=${HOME}/.passwd-s3fs -o url= -o nomultipart -o use_path_request_style -o endpoint=ap-hyderabad-1

[root@funebs122 ~]# 
[root@funebs122 ~]# cd /rman
[root@funebs122 rman]# df -h .
Filesystem      Size  Used Avail Use% Mounted on
s3fs             16E     0   16E   0% /rman

It has been successfully mounted.

We can add this in the /etc/fstab as well to mount automatically after reboot

s3fs#RMAN_BACKUP /rman fuse _netdev,allow_other,use_path_request_style,nonempty,passwd_file=/root/.passwd-s3fs,url= 0 0

Unmounting the File System

To Unmounting the File System you need to use the "fusermount" command:

# fusermount -u mountpoint

If you like please follow and comment