OCI Object Storage: Mount on OCI VM as a File System

Backing up folder level data from Block Volume to OCI Object Storage

Santhosh Kumar BVSRK
4 min readApr 29, 2024

Use Case

I recently encountered a use case where the customer wants to preserve folder level backup of Block Volume (older than a month) on the OCI Object Storage “Archival” Tier since it was so economical.

In this blog, we will see how we can take backup of OCI Block Volume to a VM to which the Block Volume is attached. As the procedure varies based on OS, I will break it into 2 sections which is for Linux (Oracle Enterprise Linux) & Windows (as these are the Operating systems used by majority of the customers).

Pre-Requisites

  1. You have an OEL VM provisioned with access.
  2. You have an OCI Object Storage bucket created.
  3. You have access to create Dynamic Group and IAM Policy.

OEL aka Oracle Enterprise Linux

For Oracle Enterprise Linux, OCI has built a utility called “ocifs”. So, we will make use of this to mount OCI Object Storage on to our OCI VM.

  1. Install ocifs “sudo dnf install ocifs” ## This installs “ocifs” utility on your Linux VM.
  2. To mount OCI Object Storage on to VM you need to provide some authentication type. The allowed authentication methods are Instance Principal & API Key. (It is best to use Instance Principal, so that we don’t store any user data on the VM). To use instance principal, let us create a Dynamic Group and assign the VM OCID in the Dynamic Group. Then create an IAM policy where we assign access to OCI Object Storage in a compartment to the resources in Dynamic Group.

3. Now, let us mount OCI Object Storage on to the VM using the command “ocifs — auth=instance_principal <ObjectStorageBucket/folder> <DirOnVM>”.

Structure of my OCI Object Storage Bucket

This is the Bucket where I have created a folder for a VM i.e., OEL_VM01 and subfolders in the bucket as subfolders in VM.

Folder structure in VM

Now, will mount OEL_VM01/app_folder1 of the bucket on to app_folder1 folder and similarly for app_folder2 on VM.

4. Now, let us place a file on the above-mentioned directory in VM, so that the same will be replicated/backed-up on to OCI Object Storage Bucket/Folder on to which you have mounted it in the last step.

Data on VM
Content on OCI Object Storage Bucket

Have created the OCI Object Storage bucket Default Storage Tier as “Archive”, hence the files are in Archive Tier.

5. Now, let us unmount Object Storage bucket from this VM and mount it on to another VM, to see if we can still get the files. To unmount run the command “fusermount -u <DirOnVM>”.

6. Now, to mount it on to another VM for checking, you have to repeat the above steps 1–4 and before mounting make sure you create directory.

7. Now, let us check if this will allow us to access the file content or not as the file is in Archival Storage Tier.

If you want to retain these files on the VM Block Storage even after unmounting the Bucket, then you have to first move the files from restore the files in bucket from Archival and then copy the files to Block Volume as unmounting will empty the /app_folder1 & /app_folder2 directories on the VM.

You can follow this blog if you want to achieve the same using rclone.

--

--

Santhosh Kumar BVSRK
Santhosh Kumar BVSRK

Written by Santhosh Kumar BVSRK

17+ Years in IT/ITES| ML & AI Enthusiast| Oracle Cloud Architect, Integration Specialist — BPEL, OSB, OIC, IICS| Database Scripting-SQL, PL/SQL, MySQL

No responses yet