Create a Storage Volume
/storage/volume/
* Create a storage volume to store data and applications. While creating such a storage volume, you must specify values for the following parameters: size
, name
, and properties
.
* Create a bootable storage volume by associating a storage volume with a machine image. While creating an instance, you can specify a bootable storage volume as a persistent boot disk for the instance. While creating a bootable storage volume, you must specify values for the following parameters: bootable
, name
, imagelist
, size
, and properties
.
* Create a storage volume from a colocated snapshot of a storage volume. Colocated snapshots are stored in the same physical location as the original storage volume. While creating a storage volume from a colocated snapshot, you must specify values for the following parameters: name
, multipart name of the snapshot
, size
, and properties
(Properties name has to be same as the parent storage volume of the snapshot). If you are restoring a bootable storage volume from a snapshot, additionally you must specify the value for bootable
as true
.
* Create a storage volume from a remote snapshot of a storage volume. Remote 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. While creating a storage volume from a remote snapshot, you must specify values for the following parameters: name
, snapshot_id
, size
, and properties
(properties name can be different from the parent storage volume of the snapshot). If you are restoring a bootable storage volume from a snapshot, additionally you must specify the value for bootable
as true
.
After creating storage volumes you can attach them to instances by using the HTTP request, POST /storage/attachment/ (Create a Storage Attachment).
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
-
availability_domain(optional):
string
The availability domain the volume is in.
-
bootable(optional):
boolean
A boolean field that indicates whether the storage volume can be used as the boot disk for an instance.
The default value is
false
.If you set the value to
true
, then you must specify values for the following parameters:imagelist
The machine image that you want to extract on to the storage volume that you're creating.
imagelist_entry
(Optional) The version of the image list entry that you want to extract. The default value is 1.
-
description(optional):
string
The description of the storage volume.
-
imagelist(optional):
string
Name of machineimage to extract onto this volume when created.
-
imagelist_entry(optional):
integer
Specific imagelist entry version to extract.
-
name:
string
The three-part name of the object (
/Compute-identity_domain/user/object
).Object names can contain only alphanumeric characters, hyphens, underscores, and periods. Object names are case-sensitive.
-
properties:
array properties
The storage-pool property.
For storage volumes that require low latency and high IOPS, such as for storing database files, specify
/oracle/public/storage/latency
.For all other storage volumes, specify
/oracle/public/storage/default
. -
size:
string
The size of this storage volume. Use one of the following abbreviations for the unit of measurement:
B
orb
for bytesK
ork
for kilobytesM
orm
for megabytesG
org
for gigabytesT
ort
for terabytes
For example, to create a volume of size 10 gigabytes, you can specify
10G
, or10240M
, or10485760K
, and so on.The allowed range is from 1 GB to 2 TB, in increments of 1 GB.
If you are creating a bootable storage volume, ensure that the size of the storage volume is greater than the size of the machine image that you want to extract on to the storage volume.
If you are creating this storage volume from a storage snapshot, ensure that the size of the storage volume that you create is greater than the size of the storage snapshot.
-
snapshot(optional):
string
Specify the multipart name of the storage volume snapshot if you are creating a storage volume from a colocated storage snapshot.
-
snapshot_account(optional):
string
Account of the parent snapshot from which the storage volume is restored.
-
snapshot_id(optional):
string
ID of the snapshot from which you want to restore the storage volume. It is mandatory to provide a value for this parameter when you are restoring a storage volume from a remote snapshot.
-
tags(optional):
array tags
Strings that you can use to tag the storage volume.
array
The storage-pool property.
For storage volumes that require low latency and high IOPS, such as for storing database files, specify /oracle/public/storage/latency
.
For all other storage volumes, specify /oracle/public/storage/default
.
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
Shows the default account for your identity domain.
-
availability_domain(optional):
string
The availability domain the volume is in.
-
bootable(optional):
boolean
true
indicates that the storage volume can also be used as a boot disk for an instance. -
description(optional):
string
The description of the storage volume.
-
hypervisor(optional):
string
The hypervisor that this volume is compatible with.
-
imagelist(optional):
string
Name of machine image to extract onto this volume when created. This information is provided only for bootable storage volumes.
-
imagelist_entry(optional):
integer
Specific imagelist entry version to extract.
-
machineimage_name(optional):
string
Three-part name of the machine image. This information is available if the volume is a bootable storage volume.
-
managed(optional):
boolean
All volumes are managed volumes. Default value is
true
. -
name(optional):
string
The three-part name of the object (
/Compute-identity_domain/user/object
). -
platform(optional):
string
The OS platform this volume is compatible with.
-
properties(optional):
array properties
The storage-pool property:
/oracle/public/storage/latency
or/oracle/public/storage/default
. -
quota(optional):
string
Not used
-
readonly(optional):
boolean
Boolean field indicating whether this volume can be attached as readonly. If set to False the volume will be attached as read-write.
- shared(optional): boolean
-
size(optional):
string
The size of this storage volume.
-
snapshot(optional):
string
Name of the parent snapshot from which the storage volume is restored or cloned.
-
snapshot_account(optional):
string
Account of the parent snapshot from which the storage volume is restored.
-
snapshot_id(optional):
string
Id of the parent snapshot from which the storage volume is restored or cloned.
-
status(optional):
string
The current state of the storage volume.
-
status_detail(optional):
string
Details about the latest state of the storage volume.
-
status_timestamp(optional):
string
It indicates the time that the current view of the storage volume was generated.
-
storage_pool(optional):
string
The storage pool from which this volume is allocated.
-
tags(optional):
array tags
Comma-separated strings that tag the storage volume.
-
uri(optional):
string
Uniform Resource Identifier
-
writecache(optional):
boolean
Not used
array
/oracle/public/storage/latency
or /oracle/public/storage/default
.Examples
Creating a storage volume
cURL Command
The following example shows how to create a storage volume by submitting a POST request on the REST resource using cURL. 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/volume/
-
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.
{ "size": "10G", "properties": ["/oracle/public/storage/default"], "name": "/Compute-acme/jack.jones@example.com/vol1" }
Example of Response Body
The following example shows the response body in JSON format.
{ "status": "Initializing", "account": "/Compute-acme/default", "writecache": false, "managed": true, "description": null, "tags": [], "bootable": false, "hypervisor": null, "quota": null, "uri": "https://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/vol1", "status_detail": "The storage volume is currently being initialized.", "imagelist_entry": -1, "storage_pool": "/Compute-acme/storagepool/iscsi/thruput_1", "machineimage_name": null, "status_timestamp": "2015-06-01T11:15:57Z", "shared": false, "imagelist": null, "size": "10737418240", "properties": ["/oracle/public/storage/default"], "name": "/Compute-acme/jack.jones@example.com/vol1" }
Creating a bootable storage volume
cURL Command
The following example shows how to create a storage volume by submitting a POST request on the REST resource using cURL. For more information about cURL, see Use cURL. While creating a bootable storage volume, the size of the storage volume must be at least 5% higher than the size of the machine image that you are associating with the storage volume.
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" -d "@requestbody.json" https://api-z999.compute.us0.oraclecloud.com/storage/volume/
-
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 to create a bootable storage volume. The machine image you specify is extracted on to the storage volume that you are creating.
{ "size": "20G", "properties": ["/oracle/public/storage/default"], "name": "/Compute-acme/jack.jones@example.com/vol2", "bootable": true, "imagelist": "/Compute-acme/jack.jones@example.com/ol6" }
Example of Response Body
The following example shows the response body in JSON format.
{ "status": "Initializing", "account": "/Compute-acme/default", "writecache": false, "managed": true, "description": null, "tags": [], "bootable": true, "hypervisor": null, "quota": null, "uri": "https://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/vol2", "snapshot": null, "status_detail": "The storage volume is currently being initialized.", "imagelist_entry": 1, "storage_pool": "/Compute-acme/storagepool/iscsi/thruput_1", "machineimage_name": "/Compute-acme/jack.jones@example.com/linux-oel-6.7-x86_64", "status_timestamp": "2016-04-18T14:24:05Z", "shared": false, "imagelist": "/Compute-acme/jack.jones@example.com/ol6", "size": "21474836480", "properties": ["/oracle/public/storage/default"], "name": "/Compute-acme/jack.jones@example.com/vol2" }
Creating a storage volume from a colocated storage snapshot
cURL Command
The following example shows how to create a storage volume from a storage snapshot by submitting a POST request on the REST resource using cURL. For more information about cURL, see Use cURL. While creating a storage volume from a storage snapshot, the size of the storage volume must be higher than the size of the snapshot. Colocated storage 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 within a site. However, you can't restore volumes across sites using colocated snapshots.
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" -d "@requestbody.json" https://api-z999.compute.us0.oraclecloud.com/storage/volume/
-
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 to create a storage volume from a colocated snapshot named /Compute-acme/jack.jones@example.com/vol1/a4faad09393d67cb1acb1f6986feb4c916d6d4d77082c8167924c4bb68b09a5c
.
{ "size": "20G", "properties": ["/oracle/public/storage/default"], "name": "/Compute-acme/jack.jones@example.com/vol3", "description": "Storage volume created from a remote storage snapshot", "snapshot": "/Compute-acme/jack.jones@example.com/vol1/a4faad09393d67cb1acb1f6986feb4c916d6d4d77082c8167924c4bb68b09a5c" }
Example of Response Body
The following example shows the response body in JSON format.
{ "managed": true, "status_timestamp": "2016-07-07T13:05:19Z", "snapshot_account": "/Compute-acme/cloud_storage", "machineimage_name": null, "snapshot_id": "a4faad09393d67cb1acb1f6986feb4c916d6d4d77082c8167924c4bb68b09a5c", "imagelist": null, "writecache": false, "size": "21474836480", "storage_pool": null, "shared": false, "status": "Initializing", "description": "Storage volume created from a remote storage snapshot", "tags": [], "quota": null, "status_detail": "The storage volume is currently being initialized.", "properties": [ "/oracle/public/storage/default" ], "account": "/Compute-acme/default", "name": "/Compute-acme/jack.jones@example.com/vol3", "bootable": false, "hypervisor": null, "uri": "http://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/vol3", "imagelist_entry": -1, "snapshot": "/Compute-acme/jack.jones@example.com/vol1/a4faad09393d67cb1acb1f6986feb4c916d6d4d77082c8167924c4bb68b09a5c" }
You can also restore a storage volume across sites. See Restoring a Storage Volume from a Remote Snapshot.