Back to the main page

Mounting OCI Object Storage Bucket as File System

Intro

This has been tested on Oracle Linux 7.
It's done using s3fs-fuse, that allows OL to mount OCI (Oracle Cloud Infrastructure) bucket via FUSE. The FUSE allows implementation of fully functional filesystem in a userspace program.

Create OCI object storage bucket

For example, via OCI console, make standard one, named bucket2fs.



And upload some file.

Install s3fs on OL7

Install this on a system that will mount a bucket.

yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/s/s3fs-fuse-1.85-1.el7.x86_64.rpm

Configure credentials

The system mounts bucket using credentials. Same credential file can be used on multiple systems.

Generate secret key: In OCI console - User Settings - Click Customer Secret Keys - click Generate Secret Key. Give name, for example s3fs-mount

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.
Save credentials in OL7, in the file /root/.s3fs-password (root:root 600), file example:

# access-key:secret-key 16ca909a8889c8d0c5da6dxxxxxxcb696d980f4a:HzkbW8wSA4Aoxxxxxxbhb715wxqZHUUZZZ6twikcu3Q=

Mount file system

For example, create /u01 and mount object storage bucket. Since this is OCI object storage, options in below commands are mandatory (in case of AWS, they can be omitted).
Note that URL is https://<tenancy>.compat.objectstorage.<region>.oraclecloud.com

# s3fs bucket2fs /u01 -o passwd_file=/root/.s3fs-password -o url=https://<my-tenancy>.compat.objectstorage.<my-region>.oraclecloud.com/ -o nomultipart -o use_path_request_style # ls -la /u01 total 864261 drwx------ 1 root root 0 Dec 31 1969 . dr-xr-xr-x. 32 root root 4096 Aug 15 15:05 .. -rw-r----- 1 root root 884998144 Aug 15 14:25 OVS-3.4.4-1709.iso # mount | grep /u01 s3fs on /u01 type fuse.s3fs (rw,nosuid,nodev,relatime,user_id=0,group_id=0)

If you want mount to be persistent over reboot, better adding the line in /etc/fstab

#s3fs bucket2fs /u01 fuse.s3fs nomultipart,use_path_request_style,passwd_file=/root/.s3fs-password,url=https://<my-tenancy>.compat.objectstorage.<my-region>.oraclecloud.com/

This can be done on any systems that mount a bucket.

Usage

OCI object storage can be of two types: frequently accessed "hot" storage (Object storage), and less frequently accessed "cold" storage (Archive storage). There is potential of on premises system to mount and use it, instead of NFS share, or additional local or iSCSI disks.

Limitations

Some of them are:
Back to the main page