Create a Storage Volume Snapshot

post

/storage/snapshot/

Creates a storage volume snapshot. 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.

To create a snapshot of a bootable storage volume that is currently being used by an instance, you should delete the instance before you create the snapshot, to ensure the consistency of data. 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. Ensure that you stop only the instance orchestration and not the orchestration that creates storage volumes. That way, only your instance is deleted and re-created and storage volumes or other resources defined in other orchestrations are not deleted. You can create the instance again later on, after the snapshot is created.

To use this snapshot to create a storage volume, see Create a Storage Volume.

Prerequisite: Before creating a remote storage snapshot, 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 My Services. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

Request

Supported Media Types
Header Parameters
Body ()
The request body contains details of the storage volume snapshot that you want to create.
Root Schema : StorageSnapshot-post-request
Type: object
The request body contains details of the storage volume snapshot that you want to create.
Show Source
  • Description of this storage snapshot.
  • Three-part name of the object (/Compute-identity_domain/user/object). Object names can contain only alphanumeric, underscore (_), dash (-), and period (.) characters. Object names are case-sensitive. If you do not specify a name for this object, the object name is generated automatically.
    • If you don't specify a value, a remote snapshot is created. Remote snapshots aren't stored in the same location as the original storage volume. Instead, they are reduced and stored in the associated Oracle Cloud Infrastructure Object Storage Classic instance. Remote snapshots are useful if your domain spans multiple sites. With remote snapshots, you can create a snapshot in one site, then switch to another site and create a copy of the storage volume on that site. 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.
    • Specify /oracle/private/storage/snapshot/collocated to create a collocated snapshot. Colocated 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. Colocated snapshots and volumes from colocated snapshots can be created very quickly. Colocated snapshots are useful for quickly restoring storage volumes within a site. However, you can't restore volumes across sites using colocated snapshots.
  • tags
    Strings that describe the storage snapshot and help you identify it.
  • Three-part name of the storage volume (/Compute-identity_domain/user/object) of which you want to create a snapshot.
Nested Schema : tags
Type: array
Strings that describe the storage snapshot and help you identify it.
Show Source

Response

Supported Media Types

201 Response

Created. See Status Codes for information about other possible HTTP status codes.
Headers
Body ()
Root Schema : StorageSnapshot-response
Type: object
Show Source
Nested Schema : repl_target_regions
Type: array
Not used
Show Source
Nested Schema : tags
Type: array
Comma-separated list of strings that describe the storage snapshot.
Show Source

Examples

Creating a remote storage snapshot

cURL Command

The following example shows how to create a remote snapshot of a storage volume by submitting a POST request on the REST resource using cURL. Remote snapshots aren't stored in the same location as the original storage volume. Instead, they are reduced and stored in the associated Oracle Cloud Infrastructure Object Storage Classic instance. For information about cURL, see Use cURL.

Enter the command on a single line. Line breaks are used in this example for readability.

curl -i -X POST
     -H "Cookie: $COMPUTE_COOKIE"
     -H "Content-Type: application/oracle-compute-v3+json"
     -H "Accept: application/oracle-compute-v3+json"
     -d "@requestbody.json"
        https://api-z999.compute.us0.oraclecloud.com/storage/snapshot/

COMPUTE_COOKIE is the name of the variable in which you stored the authentication cookie earlier. See Quick Start.

Example of Request Body

The following shows an example of the request body content in the requestbody.json file.

{
  "volume": "/Compute-acme/jack.jones@example.com/vol1",
  "description": "Remote snapshot of vol1"
}

Example of Response Body

The following example shows the response body in JSON format.

{
  "status": "initializing",
  "start_timestamp": "2017-05-19T10:14:03Z",
  "account": "/Compute-acme/cloud_storage",
  "repl_target_regions": null,
  "description": "Remote snapshot of vol1",
  "tags": [],
  "snapshot_timestamp": null,
  "snapshot_id": "a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0",
  "image_metadata_bag": null,
  "uri": "https://api-z999.compute.us0.oraclecloud.com/storage/snapshot/Compute-acme/jack.jones@example.com/vol1/a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0",
  "status_detail": "The storage snapshot is currently being initialized.",
  "volume": "/Compute-acme/jack.jones@example.com/vol1",
  "platform": null,
  "machineimage_name": null,
  "size": "10737418240",
  "status_timestamp": "2017-05-19T10:14:03Z",
  "repl_source_region": "us0",
  "property": "/oracle/public/storage/snapshot/default",
  "parent_volume_bootable": "false",
  "name": "/Compute-acme/jack.jones@example.com/vol1/a365de8c2a092d06bea549ff4e3f7508b42c6a2fad3c57b8e055d38b5b9cbded-us0"
}

Creating a colocated storage snapshot

cURL Command

The following example shows how to create a colocated snapshot of a storage volume by submitting a POST request on the REST resource using cURL. Colocated 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. Colocated snapshots and volumes from colocated snapshots can be created very quickly. Colocated snapshots are useful for quickly cloning storage volumes within a site. For more information about cURL, see Use cURL.

Enter the command on a single line. Line breaks are used in this example for readability.

curl -i -X POST
     -H "Cookie: $COMPUTE_COOKIE"
     -H "Content-Type: application/oracle-compute-v3+json"
     -H "Accept: application/oracle-compute-v3+json"
     -d "@requestbody.json"
        https://api-z999.compute.us0.oraclecloud.com/storage/snapshot/
  • COMPUTE_COOKIE is the name of the variable in which you stored the authentication cookie earlier. For information about retrieving the authentication cookie and storing it in a variable, see Authentication.

  • api-z999.compute.us0.oraclecloud.com is an example REST endpoint URL. Change this value to the REST endpoint URL of your Compute Classic site. For information about finding out REST endpoint URL for your site, see Send Requests.

Example of Request Body

The following shows an example of the request body content in the requestbody.json file.

{
  "volume": "/Compute-acme/jack.jones@example.com/vol1",
  "property": "/oracle/private/storage/snapshot/collocated",
  "description": "Colocated snapshot of vol1",
  "tags": ["vol1"]
}

Example of Response Body

The following example shows the response body in JSON format.

{
   "status": "initializing",
   "start_timestamp": "2016-07-15T06:23:33Z",
   "name": "/Compute-acme/jack.jones@example.com/vol1/d1235ce8155909f0d601cf26c18c95c2786cfb07ece17d8d02676d121eea6485",
   "tags": ["vol1"],
   "description": "Colocated snapshot of vol1",
   "snapshot_timestamp": null,
   "account": null,
   "uri": "https://api-z999.compute.us0.oraclecloud.com/storage/snapshot/Compute-acme/jack.jones@example.com/vol1/d1235ce8155909f0d601cf26c18c95c2786cfb07ece17d8d02676d121eea6485",
   "volume": "/Compute-acme/jack.jones@example.com/vol1",
   "snapshot_id": "d1235ce8155909f0d601cf26c18c95c2786cfb07ece17d8d02676d121eea6485",
   "status_detail": "The storage snapshot is currently being initialized.",
   "property": "/oracle/private/storage/snapshot/collocated",
   "machineimage_name": null,
   "status_timestamp": "2016-04-06T05:03:21Z",
   "size": "10737418240"
}