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

                                       

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

 

Prerequisites:
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=https://mynamespace.compat.objectstorage..oraclecloud.com/ -o nomultipart -o use_path_request_style


Add an entry in the /etc/fstab file.

#s3fs
bk_orap2g /home/oracle/bkp_db fuse.s3fs _netdev,allow_other,nomultipart,use_path_request_style,passwd_file=/home/oracle/.passwd-bk,url=https://mynamespace.bej2.objectstorage.eu-frankfurt-1.oraclecloud.com/ 0 0

or add an entry to crontab to mount bucket on reboot.

@reboot s3fs bucket2fs /home/oracle/bkp_db -o passwd_file==${HOME}/.password-bk -o url=https://mynamespace.compat.objectstorage..oraclecloud.com/ -o nomultipart -o use_path_request_style




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=


 



No comments:

Post a Comment