Create a Storage Volume Snapshot
/storage/snapshot/
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
- application/oracle-compute-v3+json
-
Cookie: string
The Cookie: header must be included with every request to the service. It must be set to the value of the set-cookie header in the response received to the POST /authenticate/ call.
object
-
description(optional):
string
Description of this storage snapshot.
-
name(optional):
string
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. -
property(optional):
string
- 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(optional):
array tags
Strings that describe the storage snapshot and help you identify it.
-
volume:
string
Three-part name of the storage volume (
/Compute-identity_domain/user/object
) of which you want to create a snapshot.
Response
- application/oracle-compute-v3+json
201 Response
-
set-cookie: string
The cookie value is returned if the session is extended
object
-
account(optional):
string
Account to use for snapshots
-
description(optional):
string
Description of this storage snapshot.
-
machineimage_name(optional):
string
The name of the machine image that's used in the boot volume from which this snapshot is taken
-
name(optional):
string
Multipart name of the storage snapshot.
-
parent_volume_bootable(optional):
string
Field indicating whether the parent storage volume is bootable.
-
platform(optional):
string
The OS platform this snapshot is compatible with.
-
property(optional):
string
/oracle/private/storage/snapshot/collocated
indicates that the snapshot is stored in the same physical location as the original storage volume./oracle/public/storage/snapshot/default
indicates that the snapshot 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.
-
repl_source_region(optional):
string
Not used
-
repl_target_regions(optional):
array repl_target_regions
Not used
-
size(optional):
string
The size of the storage snapshot in bytes.
-
snapshot_id(optional):
string
A unique id for this snapshot auto-generated by the server.
-
snapshot_timestamp(optional):
string
Timestamp of the storage snapshot, generated by storage server. The snapshot will contain data written to the original volume before this time.
-
start_timestamp(optional):
string
Timestamp when the operation is started.
-
status(optional):
string
Current status of the storage snapshot.
-
status_detail(optional):
string
Details about the latest state of the storage volume snapshot.
-
status_timestamp(optional):
string
Indicates the time that the current view of the storage volume snapshot was generated.
-
tags(optional):
array tags
Comma-separated list of strings that describe the storage snapshot.
-
uri(optional):
string
Uniform Resource Identifier
-
volume(optional):
string
The name of the parent storage volume of this storage snapshot.
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" }