Mounting an Oracle Cloud Object Storage Bucket as a File System on Linux

Today I bring a very cool article of a need that arose to present an Object Storage on Linux to perform a backup.
You can use it to backup your database, upload files, and more
Ensure 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 Setting.


Create an Object Storage Bucket from the OCI Console.

Click in Object Storage
Enter a name for the bucket and click on Create Bucket.
Install s3fs-fuse
You can install s3fs-fuse by using a prebuilt package from the Oracle Linux EPEL repository. In this post, I’m using the binary RPM.
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 the key a meaningful name (for example, bk_orap2g), and then click Generate Secret Key
Copy and save the secret key because it won’t be shown again.
The S3 credentials are created by using an access key and the secret key. The access key is displayed in the Customer Secret Keys area of the Console.
Generate Secret Key: bk_orap2g
Generated Key: xxxxxxxxxxxxN5ujFRYICdG5RQbiuyxi07+PWrLdE=
Access key: cc3e970b898676154xxxxxxxxxxxxxxxxxxxxxxxx
Create the directory and assign ownership


# mkdir /home/oracle/bkp_db
# chown oracle:oinstall /home/oracle/bkp_db
Mount the File System


$ s3fs bucket2fs /home/oracle/bkp_db -o passwd_file==${HOME}/.password-bk -o url= -o nomultipart -o use_path_request_style
Add an entry in the /etc/fstab file.
bk_orap2g /home/oracle/bkp_db fuse.s3fs _netdev,allow_other,nomultipart,use_path_request_style,passwd_file=/home/oracle/.passwd-bk,url= 0 0
If you get the following error, change the permission of /usr/bin/fusermount:
fuse: failed to exec fusermount: Permission denied
[oracle@ora2pg ~]$ ls -l /usr/bin/fusermount
-rwsr-x---. 1 root fuse 32584 Fev 25 2021 /usr/bin/fusermount
Run the following command, and then try again:
[oracle@ora2pg ~]# sudo chmod +x /usr/bin/fusermount

[oracle@ora2pg ~]$ ls -l /usr/bin/fusermount
-rwsr-x–x. 1 root fuse 32584 Fev 25 2021 /usr/bin/fusermount

If there’s an issue, add the Debug parameter to help troubleshoot:
[oracle@ora2pg ~]$ s3fs bucket-1 /test_bucket -o passwd_file=${HOME}/.passwd-s3fs -o dbglevel=info -f -o curldbg=
I hope this helps you!!!


Stay tuned, following on twitter @aontalba and on Linkedin


Andre Luiz Dutra Ontalba


Disclaimer: “The postings on this site are my own and don’t necessarily represent my actual employer positions, strategies or opinions. The information here was edited to be useful for general purposes. Specific data and identifications were removed to allow reach generic audience and be useful.”