OCIFS
Access Object Storage buckets as a file system
Austine Ouma
8/16/20255 min read


Can I mount my object storage bucket as a traditional file system?
Picture this: you have an object storage bucket on OCI with a couple of your files. You (or your applications) need to access these files as seamlessly as possible, say, like you would any other files in an NFS share. Or maybe you need to store more files than your host can accommodate, think large data pump files, say a TB or two, much larger than the default /u01 directory created with a Base Database system, which you need to import into the database. You cannot extend that mount point, and for some reason, you cannot use the File System Storage (FSS) as an option. What to do?
Aha! Why not take advantage of the "unlimited" storage available with Object Storage, upload those files in a bucket, and mount that bucket as a file system on your Base DB? That way, your applications can see the files on Object storage as if they were resident on the Base Database system itself. Sounds familiar? Probably, especially if you've seen my article or other collateral on how to use s3fs-fuse (Filesystem in USErspace) on Oracle Linux 7 to mount an Oracle Object Storage bucket as a file system. But how can you do the same on Oracle Linux 8 or 9? This is where OCIFS comes in. The Oracle Cloud Infrastructure File System (OCIFS) provides a file system interface to Oracle Object Storage and allows one to access and manipulate Object Storage bucket contents as if they were on a regular file system. You'll be able to list, copy, move, or even delete files using OS commands like you would any other regular OS files. And may I just say, the installation and configuration of OCIFS is much easier and faster than s3fs-fuse on Oracle Linux 7.
Environment Set Up
For this session, I will set up OCIFS on a Base Database System on OCI and mount an Object Storage bucket with two dummy Oracle Data Pump dump files that presumably couldn't fit the existing DB System file system. The DB system already has the OCI CLI pre-installed, so I will not need to do this again, however, should you need to, I've a guide on that which you can find here. We will also have to install python on the instance from which we'll access object storage.
As user opc on the database system, install python;
$ sudo dnf module install python39
Setting up OCIFS
You can install OCIFS on an Oracle Linux 8 machine or later. Some of the prerequisites are;
An OCI Object Storage bucket that can be accessed from the instance you plan to set up OCIFS.
Local disk space used as a cache for object storage objects for best performance with access times.
A CLI configuration file.
Set up Object Storage (Bucket & Dump Files)
Create a bucket
In the bucket, I have uploaded a 5GB dummy dump file
Install OCIFS
As the root user, run;
# yum install ocifs
To update the OCIFS utility, run
# yum update ocifs
To Set api key environment variables. Follow the OCI CLI setup instructions
export OCIFS_IAM_TYPE=api_key
export OCIFS_CONFIG_LOCATION=~/.oci/config
export OCIFS_CONFIG_PROFILE=DEFAULT
Create a Directory and Mount the File System
$ mkdir /u01/ocifs_bucket
$ ocifs OCIFS_Test /u01/ocifs_bucket
If you've not set up oci on your machine, you'll get the following error when you attempt to mount the file system.
If this is the case, then you can quickly set up oci on your machine by running this command as shown on the screenshot below;
$ oci setup config
Make sure you have your user and tenancy OCIDs at hand as well as your tenancy region which you can get from your tenancy URL in your browser as show below.
With this information, follow the instructions as shown below.
Add the key to your profile in the OCI console by selecting the 'Tokens and Keys' tab and adding an API key. Paste ALL the lines in your public key generated above and ensure the fingerprints match.
You can now mount your file system. No feedback is good feedback. LoL. You can then cd into the bucket you just created and check to see that the files in your object storage bucket are listed. In my bucket, I have a single dummy dump file LajDump.dmp file which can now be listed in the file system I just mounted.
I then create yet another dummy file on the file system and check if the file is available in Object Storage bucket. Here, I create a file called testfile.txt
Below, you can see in the object storage bucket the new file I just created.
On my machine I remove the file (rm) and check the bucket again just to show that the file has also been deleted.
And as you can see, the file has been deleted in the bucket as well.
I hope you did find this helpful. Please let me know if anything isn't clear. Thank you.





























