Oracle Cloud Infrastructure Documentation

Using Storage Gateway File Management Operations

This topic describes how to use the Storage Gateway file management operations.

Exercise caution when using the REST API, Java library, or any other client to retrieve, create, update, or delete objects directly in a bucket that’s mapped to a file system in Storage Gateway. Until you Refresh the Storage Gateway file system, Storage Gateway is not aware of the changes and data is inconsistent between Storage Gateway and Object Storage.

Uploading Files to Buckets

Before you connect the file system to the Oracle Cloud Infrastructure Object Storage bucket, make a note of the Oracle Cloud Infrastructure Object Storage tenancy details such as namespace, tenant OCID, and compartment OCID.

Copy the files to the mounted directory on the Storage Gateway or the NFS client host. Storage Gateway writes the files to the disk cache. The system queues and asynchronously uploads the files to an Object Storage bucket. Corresponding objects are created in the storage tier you specified during file system creation, either Standard or Archive. See Creating Your First File System or Managing File Systems for details.

Note

Storage Gateway automatically performs multipart upload for files larger than 128 MB. See Using Multipart Uploads for details.

You can view files uploaded to your tenancy during the current browser session. See the Completed Uploads tab in Viewing the Details of a File System.

Reading Files

When you write a file to a Storage Gateway file system, the system stores the file in the local disk cache. You can read the file directly from the mounted directory. Storage Gateway asynchronously copies the file to the corresponding Object Storage bucket in your tenancy. To retrieve the data from the bucket using Storage Gateway, read the files from the mounted directory.

If space is available, Storage Gateway automatically places the files in the read cache. If the file is in the read cache, you can retrieve the file immediately. If the file is not available in the read cache and it is stored in the Archive tier, you must restore the object. For more information, see Restoring Files and Objects from Archive Storage.

Note

You cannot read or write to a file that is stored in the Archive tier and does not exist in the read cache. This action returns an Input/Ouput error.

Storage Gateway checks data integrity using checksum verification on uploads. The system might not be able to perform data integrity validation on a partial read, since checksum verification works only on a whole file or object.

To read the upload checksum for a file in a file system, run the following command from the NFS client on which the file system is mounted:

sudo docker exec ocisg bash -c "cd /mnt/gateway/${filesystem} && cat ${filepath}:::meta:csm"

Restoring Files and Objects from Archive Storage

You can initiate a file restore from the Storage Gateway command line. You can also initiate an object restore from Archive Storage in Oracle Cloud Infrastructure. You can read the corresponding file using Storage Gateway after the object has been restored to Object Storage.

Note

Storage Gateway supports Oracle Cloud Infrastructure Object Storage object lifecycle policies to manage the archiving and deletion of objects in a bucket according to a pre-defined schedule. Using object lifecycle policies, you can specify bucket creation in the Standard Object Storage tier, and then create a policy to schedule the subsequent movement of data to the Archive Storage tier. This lifecycle policy archival method is useful if you have on-premises applications that generate intermediary or temporary files and directories that are inappropriate for immediate archival. See Using Object Lifecycle Management for details.

Restoring Archived Files Using the Storage Gateway Command Line

To restore one or more archived files
To check the archive status of one or more files
To check the restoration job status for a file system

Restoring Archived Files Using Oracle Cloud Infrastructure

Important

If you use Oracle Cloud Infrastructure to restore archived objects, use the Refresh operation in Storage Gateway to display the data that was added or modified directly in Object Storage.

To restore an archived object using the Oracle Cloud Infrastructure Console
To check the status of an object restoration using the Oracle Cloud Infrastructure Console
To restore an archived object using the Oracle Cloud Infrastructure CLI
To check the status of an object restoration using the Oracle Cloud Infrastructure CLI

Deleting Files

Remove the files that you no longer need from the NFS client by deleting them from the directory on which the file system is mounted.