43 Storage Volume Snapshot

This section describes the Compute Classic CLI commands you can use to add, delete, and view storage volume snapshots.

Creating a snapshot of a storage volume enables you to capture all the data stored on the storage volume. You can retain snapshots as a backup, or use them to create new, identical storage volumes.

If you take multiple snapshots of a storage volume, each snapshot captures all the data stored on the storage volume. You can create either colocated or remote storage volume snapshots.

  • Colocated snapshots: Snapshots are stored in the same physical location as the original storage volume and each snapshot uses the same amount of storage as the original volume. As compared to the time taken to create a remote snapshot, colocated snapshots are created relatively quickly. Colocated snapshots are useful for quickly cloning storage volumes within a site.

  • Remote snapshots: Snapshots aren't stored in the same location as the original storage volume. Instead, they are stored in the associated Oracle Cloud Infrastructure Object Storage Classic instance. However, creating a remote snapshot and restoring a storage volume from a remote snapshot can take quite a long time depending on the size of the storage volume, as data is written to and from the Oracle Cloud Infrastructure Object Storage Classic instance.

Before running the CLI commands described in this section, make sure that you've installed the CLI client and set up the required environment variables as described in Preparing to Use the CLI.

storage-snapshot add

Creates a snapshot of the specified storage volume. Creating a storage volume snapshot enables you to capture the current state of the storage volume. You can retain snapshots as a backup, or use them to create new, identical storage volumes.

You can create a snapshot of a storage volume either when it is attached to an instance or after detaching it. If the storage volume is attached to an instance, then only data that has already been written to the storage volume will be captured in the snapshot. Data that is cached by the application or the operating system will be excluded from the snapshot.

Tip:

To create a snapshot of a bootable storage volume that is currently being used by an instance, it is recommended that you delete the instance by stopping the instance orchestration before you create the snapshot. Deleting the instance doesn’t delete any data on the bootable storage volume, because the data is stored on a persistent boot disk. When the instance is deleted, it ensures that all data is written to the storage volume and no further data can be written to the disk while taking the snapshot. You can create the instance again later, after the snapshot is created.

To use this snapshot to create a storage volume, see storage-volume add.

Prerequisite: Ensure that you have selected a replication policy for your Oracle Cloud Infrastructure Object Storage Classic instance. See Selecting a Replication Policy for Your Service Instance in Using Oracle Cloud Infrastructure Object Storage Classic.

Required Role

To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute storage-snapshot add storagevolume [--name name] [--description description] [--property property] [--tags tags] 

For help with the parameters and options of this command, run the command with the -h option.

Example 1: Creating a Remote Storage Snapshot

opc -f json compute storage-snapshot add /Compute-acme/jack.jones@example.com/vol1 --description 'Remote snapshot of vol1'

Sample Output

{
 "account": "/Compute-acme/cloud_storage",
 "description": "Remote snapshot of vol1",
 "machineimage_name": null,
 "name": "/Compute-acme/jack.jones@example.com/vol1/d21140f4df6d4746fd5035db02a78786077385dfd3f664cae08ae643c964b23b",
 "platform": null,
 "property": "/oracle/public/storage/snapshot/default",
 "size": "10737418240",
 "snapshot_id": "d21140f4df6d4746fd5035db02a78786077385dfd3f664cae08ae643c964b23b",
 "snapshot_timestamp": null,
 "start_timestamp": "2017-02-08T09:36:42Z",
 "status": "initializing",
 "status_detail": "The storage snapshot is currently being initialized.",
 "status_timestamp": "2017-02-08T09:36:42Z",
 "tags": [],
 "uri": "http://api-z999.compute.us0.oraclecloud.com/storage/snapshot/Compute-acme/jack.jones@example.com/vol1/d21140f4df6d4746fd5035db02a78786077385dfd3f664cae08ae643c964b23b",
 "volume": "/Compute-acme/jack.jones@example.com/vol1"
}

Example 2: Creating a Colocated Storage Snapshot

opc compute storage-snapshot add /Compute-acme/jack.jones@example.com/vol1 --description 'Colocated snapshot of vol1' --property /oracle/private/storage/snapshot/collocated

Sample Output

{
 "account": null,
 "description": "Colocated snapshot of vol1",
 "machineimage_name": null,
 "name": "/Compute-acme/jack.jones@example.com/vol1/2b4bb1eb967e42268e300cbdb842de40be33d74b1e858a938166013aa7362eaa",
 "platform": null,
 "property": "/oracle/private/storage/snapshot/collocated",
 "size": "10737418240",
 "snapshot_id": "2b4bb1eb967e42268e300cbdb842de40be33d74b1e858a938166013aa7362eaa",
 "snapshot_timestamp": null,
 "start_timestamp": "2017-02-08T09:45:39Z",
 "status": "initializing",
 "status_detail": "The storage snapshot is currently being initialized.",
 "status_timestamp": "2017-02-08T09:45:39Z",
 "tags": [],
 "uri": "https://api-z999.compute.us0.oraclecloud.com/storage/snapshot/Compute-acme/jack.jones@example.com/vol1/2b4bb1eb967e42268e300cbdb842de40be33d74b1e858a938166013aa7362eaa",
 "volume": "/Compute-acme/jack.jones@example.com/vol1"
}

storage-snapshot list

Retrieves details of the storage volume snapshots that are available in the specified container and match the specified query criteria. If you don't specify any query criteria, then details of all the storage volume snapshots in the container are displayed.

Required Role

To complete this task, you must have the Compute_Monitor or Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute storage-snapshot list container [--tags tags] [--since since] [--until until]

For help with the parameters and options of this command, run the command with the -h option.

Example

The following example retrieves details of snapshots that were generated from 1st to 6th October within the /Compute-acme/jack.jones@example.com container.

opc -f table compute storage-snapshot list /Compute-acme/jack.jones@example.com --since 2016-10-01T07:04:52Z --until 2016-10-06T07:04:52Z

Sample Output

+-------------------------------------------------------------------------------------------------------------+
                                                       NAME                                                        
+-------------------------------------------------------------------------------------------------------------+/Compute-acme/jack.jones@example.com/vol1/f479227d88f56d68a752f0f388c50372768087c18cd575e4146f9ff96f803f75
/Compute-acme/jack.jones@example.com/vol1/cb61eb710d69c63668128d12b5807739c3a8148d657b3a90c7cc7c5e3df374f4
+-------------------------------------------------------------------------------------------------------------+

storage-snapshot discover

Retrieves a list of storage snapshots in the specified container.

Required Role

To complete this task, you must have the Compute_Monitor or Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute storage-snapshot discover container

For help with the parameters and options of this command, run the command with the -h option.

Example

opc -f json compute storage-snapshot discover /Compute-acme/jack.jones@example.com/vol1

Sample Output

{
 "result": [
   /Compute-acme/jack.jones@example.com/vol1/dc14ed57a74c072fd2ec71ed152021eadc10bc868ae17c759f6233ee7317a15d
   /Compute-acme/jack.jones@example.com/vol1/snapshot2
 ]
}

storage-snapshot get

Retrieves details of the specified storage snapshot.

You can use the get command to verify whether add operation was completed successfully. Use the -F option (for example, -F status) to filter the output for specific attributes.

Required Role

To complete this task, you must have the Compute_Monitor or Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute storage-snapshot get name

For help with the parameters and options of this command, run the command with the -h option.

Example

opc -f json compute storage-snapshot get /Compute-acme/jack.jones@example.com/vol1/snapshot2

Sample Output

{
   "status": "completed",
   "start_timestamp": "2016-04-06T07:04:52Z",
   "name": "/Compute-acme/jack.jones@example.com/vol1/snap2",
   "tags": [],
   "description": "Snapshot of vol1",
   "snapshot_timestamp": "2016-04-06T07:01:45Z",
   "account": null,
   "uri": "https://api-z999.compute.us0.oraclecloud.com/storage/snapshot/Compute-acme/jack.jones%40example.com/vol1/snap2",
   "volume": "/Compute-acme/jack.jones@example.com/vol1",
   "snapshot_id": "04b4d060dda38f3f9efd335436c6d4b439cfdad15b048639f1e312eb8fbd082c",
   "status_detail": null,
   "property": "/oracle/private/storage/snapshot/collocated",
   "status_timestamp": "2016-04-06T07:04:53Z",
   "size": "10737418240"
 }

storage-snapshot delete

Deletes a storage snapshot. No response is returned.

You can restore or clone an existing storage volume by creating a snapshot of the storage volume and using the snapshot to create a new storage volume. You can create multiple snapshots of a storage volume. If a storage volume snapshot gets outdated, or if you no longer need a snapshot, you can delete it. You can’t delete a colocated snapshot if it has been used to create a new storage volume.

Prerequisite: Ensure that you have selected a replication policy for your Oracle Cloud Infrastructure Object Storage Classic instance. See Selecting a Replication Policy for Your Service Instance in Using Oracle Cloud Infrastructure Object Storage Classic.

Required Role

To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Syntax

opc compute storage-snapshot delete name

For help with the parameters and options of this command, run the command with the -h option.

Example

opc compute storage-snapshot delete /Compute-acme/jack.jones@example.com/vol1/snapshot2