Among all its services Oracle Cloud Infrastructure (OCI) provides the Object Storage service. This is an internet-scale, high-performance storage platform that offers reliable and cost-efficient data durability. The Object Storage service can store an unlimited amount of unstructured data of any content type, including analytic data and rich content, like images and videos.
Currently, Object Storage data can be accessed with: - The OCI console, an easy-to-use, browser-based interface. - The OCI command line interface (CLI). - Or programmatically with OCI SDKs or the OCI Rest API.
OCIFS provides an alternate way to access Object Storage data through a filesystem. With OCIFS, Object Storage data becomes accessible as regular files that you can read, write or modify with standard shell commands (
cat …) or system calls (
OCIFS requires some small setup before it can be used.
First, you need to have an OCI Object Storage bucket. You can use an empty bucket, or a bucket which is already populated with objects. If you don’t have a bucket yet, it is easy to create one from the OCI console, see Creating a Bucket in the OCI documentation. Make sure it is private.
Here is an example of a screenshot of the OCI console showing an already populated Object Storage bucket:
Then you have to create an OCI SDK/CLI configuration file
~/.oci/config. If you have already been using the OCI SDK or the OCI CLI then you should already have such a configuration file. Otherwise to create this configure file, see SDK and CLI Configuration File.
The only requirement is that the configuration file should have a
[DEFAULT] section with the following entries:
Here is a configuration file example:
$ cat ~/.oci/config [DEFAULT] user=ocid1.user.oc1..<unique_ID> fingerprint=00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff tenancy=ocid1.tenancy.oc1..<unique_ID> region=us-ashburn-1 key_file=~/.oci/oci_api_key.pem
OCIFS is available in the Oracle Cloud oci_included repository on Oracle Linux 8 and 9, for Intel/AMD (x86_64) and ARM (aarch64) systems. To enable the oci_included repository, see Installing Software on Oracle Linux Instances.
To install OCIFS, install the ocifs package:
$ sudo yum install ocifs
Once OCIFS is installed and configured, an available OCI Object Storage bucket can be mounted as a filesystem and its objects are accessible as regular files.
ocifs command is used to mount an existing OCI Object Storage bucket as a filesystem. OCIFS is a
fuse(8) filesystem so root privileges are not required to use OCIFS.
Here is an example to mount the
bucket-1 OCI Object Storage bucket on the
$ mkdir ~/mydir $ ocifs bucket-1 ~/mydir
After an OCI Object Storage bucket is mounted, OCI Object Storage data are accessible as regular files. So you can use your favorite shell commands or programming language to read, write, modify or add OCI Object Storage data.
Here is a simple example:
$ ls -l mydir total 0 drwxr-xr-x. 2 guest guest 65 May 12 11:58 info -rw-r--r--. 1 guest guest 227563 May 12 11:58 oracle-linux-ds.pdf -rw-r--r--. 1 guest guest 33792 May 12 11:58 oracle_linux.jpg $ ls -l mydir/info total 0 -rw-r--r--. 1 guest guest 2129 May 12 11:58 CONTRIBUTING.md -rw-r--r--. 1 guest guest 1845 May 12 11:58 LICENSE.txt -rw-r--r--. 1 guest guest 3441 May 12 11:58 README.md $ echo "Store data on OCIFS" > mydir/newfile $ ls -l mydir total 4 drwxr-xr-x. 2 guest guest 65 May 12 11:58 info -rw-rw-r--. 1 guest guest 20 May 12 12:04 newfile -rw-r--r--. 1 guest guest 227563 May 12 11:58 oracle-linux-ds.pdf -rw-r--r--. 1 guest guest 33792 May 12 11:58 oracle_linux.jpg $ cat mydir/newfile Store data on OCIFS
Finally, when you don’t need access to the OCI Object Storage data anymore, you can unmount the OCIFS filesystem using the
$ fusermount -u ~/mydir
Give it a try! OCIFS provides a new simple and efficient solution to access OCI Object Storage data, and it aims to take advantage of features provided by Oracle Cloud Infrastructure. For more information, check the OCIFS Utility documentation .