Configure File System Snapshots and Clone

Summary

File system snapshots can be created manually or a regular schedule. Snapshots can be used to clone a file system at a point in time.

Reference

Snapshot Types

There are three (3) types of snapshots:

  1. User-created
  2. Policy-based
  3. Replication

Create Snapshot

Use the oci fs snapshot create command. The sample code creates a file system snapshot, called 'my_snapshot', that expires in 90 days:

oci fs snapshot create                  \
  --file-system-id ${file_system_OCID}  \
  --name "my_snapshot"                  \
  --expiration-time $((( $(date +'%s') + 86400 * 90 )))

Cloning File Systems

A clone is a new file system that is based on a snapshot. Clones can be cloned.

Use the following commands to clone a file system:

oci fs file-system create \
  --availability-domain ${ad_name} \
  --display-name "Clone of my file system" \
  --clone-attach-status ATTACH \
  --compartment-id ${sandbox_oci} \
  --source-snapshot-id ${snapshot_OCID}