How to Setup OCI Storage Gateway?

What is Storage Gateway?

Using Storage Gateway, your applications can interact with Oracle Cloud Infrastructure Object Storage through standard NFSv4 protocols. You connect Storage Gateway file systems to Object Storage buckets. Storage Gateway stores files as objects in an Oracle Cloud Infrastructure Object Storage bucket and supports multipart uploads for large objects. Object Storage does not, however, support symbolic links, hard links, or special device files.

Storage Gateway is installed in an Oracle Cloud Infrastructure compute instance or as a Linux Docker instance on one or more hosts in your on-premises data center. Applications store and retrieve objects from Oracle Cloud Infrastructure Object Storage through file systems that you create in Storage Gateway.

Following steps helps to setup Storage Gateway and how to use it.

Create OCI instance

Detailed steps to create virtual machine (VM) Compute instance

Create Block Volume

Steps to create block volume from OCI console.

Attach Block Volume to Instance & Create filesystem

 sudo mkfs.xfs /dev/oracleoci/oraclevdb
 sudo mkdir /ocisg
 sudo mount /dev/oracleoci/oraclevdb /ocisg 

Generate an API Signing Key

Login to VM instance and generate API Signing Key in PEM format using below commands.

Generate Key in PEM format
 mkdir ~/.oci
 openssl genrsa -out ~/.oci/oci_api_key.pem 2048
 ls -l ~/.oci/oci_api_key.pem
 chmod go-rwx ~/.oci/oci_api_key.pem
 openssl rsa -pubout -in ~/.oci/oci_api_key.pem -out ~/.oci/oci_api_key_public.pem 
 ls -l ~/.oci/oci_api_key_public.pem
 cat ~/.oci/oci_api_key_public.pem

Upload Key to an existing user account

Copy Fingerprint for further authentication

You can generate fingerprint from command line as well
openssl rsa -pubout -outform DER -in ~/.oci/oci_api_key.pem | openssl md5 -c

Download and Install Storage Gateway
Download and Extract

Download archive

Extract files from TAR archive

cd /tmp
sudo tar xvzf ocisg-1.3.tar.gz

Install using

Script will install docker if does not exists

Important inputs

Enter the path for OCISG file system cache : /ocisg/ocisgfilecache
Enter the path for OCISG metadata storage : /ocisg/ocisgmetadata
Enter the path for OCISG log storage : /ocisg/ocisglog

NFS Port and Example script to mount

After a successful installation, the script provides the following information:

The URL to log in to the Storage Gateway management console.

The NFS port number.

An example command for mounting your Storage Gateway file systems.
mount -t nfs -o vers=4,port=32770 din-storageg-test:/<OCISG Filesystem Name> /local_mount_point

Add Security List for NFS and Console Port

Login to Storage Gateway Management Console

Login to management console using URL (https://hostname:32769/) and set new password

Main Dashboard

Create New file system

Steps to create new file system

Important fields while creating file system

Select the Object Storage tier in which you want to store your data

Object Storage API Endpoint

Compartment OCID

Tenant OCID


Public Key’s Finger Print

Private Key
PEM private key from “Generate Key in PEM format”

After filling up details SAVE and CONNECT from console

File System Created

Click on Setting Tab

Object storage Bucket Created automatically

Mount FileSystem in OCI VM instance

sudo mkdir /storagegatewaytest
sudo mount -t nfs -o vers=4,port=32770 /storagegatewaytest
df -hH

As captured in above image, df command shows Avail space 9.3E. It is knows issue of Storage Gateway where df command cannot report accurate size and capacity.

Create dummy files and verify from Object Storage Bucket

Objects Uploaded automatically

Leave a Reply

Your email address will not be published. Required fields are marked *