11
Aug

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

Create an Object Storage Bucket from the OCI Console.


Object Storage-1
Navigate to Object Storage.
 
Object Storage-2
Click Create Bucket.
 
Object Storage-3
Enter a name for the bucket and click on Create Bucket.

 
Object Storage-4
 
Install s3fs-fuse
[root@erpapp1 ~]# yum install s3fs-fuse-1*
 
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, s3fs-access), 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: s3fs-bucket1-access
Generated Key: E3uBbzahjpqSUON5ujFRYICdG5RQbiuyxi07+PWrLdE=
 
Access key: cc3e970b89867615427e0392a5kj29009ju5e492
 
Enter your credentials in a ${HOME}/.passwd-s3fs file and set owner-only permissions:

[applprod@erpapp1 ~]$ echo cc3e970b89867615427e0392a5kj29009ju5e492: E3uBbzahjpqSUON5ujFRYICdG5RQbiuyxi07+PWrLdE= > ${HOME}/.passwd-s3fs

[applprod@erpapp1 ~]$ chmod 600 ${HOME}/.passwd-s3fs

 
Create the directory and assign ownership

# mkdir /test_bucket
# chown applprod:oinstall /test_bucket

 
Mount the File System
$ s3fs bucket2fs /u01 -o passwd_file==${HOME}/.s3fs-password -o url=https://.compat.objectstorage..oraclecloud.com/ -o nomultipart -o use_path_request_style

[applprod@erpapp1 ~]$ s3fs bucket-1 /test_bucket -o passwd_file=${HOME}/.passwd-s3fs -o url=https://dbaarena.compat.objectstorage.eu-frankfurt-1.oraclecloud.com/ -onomultipart -o use_path_request_style

 
Add an entry in the /etc/fstab file.


s3fs#bucket-1 /test_bucket fuse _netdev,allow_other,use_path_request_style,passwd_file=/home/applprod/.passwd-s3fs,url=https://dbaarena.compat.objectstorage.eu-frankfurt-1.oraclecloud.com/ 0 0


[root@erpapp1 ~]# mount -a
df -h /test_bucket
s3fs 256T 0 256T 0% /test_bucket

 
If you get the following error, change the permission of /usr/bin/fusermount:
fuse: failed to exec fusermount: Permission denied


[applprod@erpapp1 ~]$ ls -l /usr/bin/fusermount
-rwsr-x---. 1 root fuse 32584 Sep 6 2016 /usr/bin/fusermount

 
Run the following command, and then try again:

[root@erpapp1 ~]# sudo chmod +x /usr/bin/fusermount


[applprod@erpapp1 ~]$ ls -l /usr/bin/fusermount
-rwsr-x--x. 1 root fuse 32584 Sep 6 2016 /usr/bin/fusermount

 
If there’s an issue, add the Debug parameter to help troubleshoot:

[applprod@erpapp1 ~]$ s3fs bucket-1 /test_bucket -o passwd_file=${HOME}/.passwd-s3fs -o dbglevel=info -f -o curldbg=

Back to Top