How to mount OCI object storage as a file system

 

In this topic I will show how to easily mount an object storage as a file system in any linux system.

In this case I am using a machine that is running on OEL 7

Step 1. Firstly, we will need to create a bucket in OCI. The steps of bucket creation is given in this post.

Step 2. Install s3fs-fuse rpm

[root@bastionhost opc]# yum install s3fs-fuse

.....

.....

Installed:

  s3fs-fuse.x86_64 0:1.86-2.el7

Dependency Installed:

  mailcap.noarch 0:2.1.41-2.el7

Complete!

[root@bastionhst opc]#



Step 3. Generate secret keys

Login to OCI console 

Click on User Settings




















Under Resources section click on Customer Secret Keys











Click on Generate Secret key to generate secret keys









Provide a name for the key.










This will generate key , it’s important to save the key as 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.

 

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

Run this from root user. 
echo ACCESS_KEY_ID:SECRET_ACCESS_KEY > ${HOME}/.passwd-s3fs

Here for  ACCESS_KEY you can get it from Generate secret key page.
For SECRET_ACCESS_KEY , we already saved it while generating it in previous step

Example:-
echo xxxxxxxxxxxxxxxxxxx:yyyyyyyyyyyyyyyyyyyyyyy > ${HOME}/.passwd-s3fs

in this example xxxxxxxxxxxxxxxxx is access key and yyyyyyyyyyyyyyyyy is secret key.

Once password file is created assign proper permission to it 
chmod 600 ${HOME}/.passwd-s3fs

Step 5. Create a directory to mount the storage and mount the object storage
mkdir /s3bucket

To mount the object storage use the following command:-

s3fs [bucket_name] [destination directory] -o endpoint=[region] -o passwd_file=${HOME}/.passwd-s3fs -o url=https://[namespace of object storage].compat.objectstorage.[region].oraclecloud.com/ -onomultipart -o use_path_request_style

example:-
s3fs test_bucket /s3bucket -o endpoint=ap-mumbai-1 -o passwd_file=${HOME}/.passwd-s3fs -o url=https://bm626z56fa0a.compat.objectstorage.ap-mumbai-1.oraclecloud.com/  -onomultipart -o use_path_request_style


Here test_bucket is our bucket name
/s3bucket denotes the local mount point where the object storage is mounted
bm626z56fa0a – this denotes the namespace of the object storage.

Step 6. Verify the mount point

[root@s3bucket]# df -h /s3bucket/
Filesystem      Size  Used Avail Use% Mounted on
s3fs            256T     0  256T   0% /s3bucket
[root@ s3bucket]#

To mount the object storage when system reboots, add the following line in /etc/fstab file.

s3fs#test_bucket /s3bucket fuse _netdev,allow_other,use_path_request_style,passwd_file=/root/.passwd-s3fs,url=https://bm626z56fa0a.compat.objectstorage.ap-mumbai-1.oraclecloud.com 0 0

2 comments:

  1. If you need to hire a real hacker to remotely monitor / hack your partner's phone, exchange or recover your stolen bitcoin, or hack any database with guaranteed privacy, contact easybinarysolutions@gmail.com or whatsapp: +1 3478577580 , they are efficient and confidential.

    ReplyDelete
  2. 01:45

    smm panel ile sosyal medya gücünü keşfet

    kıl çadır ile artık mekanlar çok daha başka

    bahis forumu , bahis forum , deneme bonusu veren siteler

    ReplyDelete