Create a Storage Volume

post

/storage/volume/

Creates a storage volume. You can create a storage volume in one of the following ways:

* 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

Supported Media Types
Header Parameters
Body ()
The request body contains details of the storage volume that you want to create.
Root Schema : StorageVolume-post-request
Type: object
The request body contains details of the storage volume that you want to create.
Show Source
  • 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.

  • The description of the storage volume.

  • Name of machineimage to extract onto this volume when created.
  • Specific imagelist entry version to extract.
  • 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

    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.

  • The size of this storage volume. Use one of the following abbreviations for the unit of measurement:

    • B or b for bytes
    • K or k for kilobytes
    • M or m for megabytes
    • G or g for gigabytes
    • T or t for terabytes

    For example, to create a volume of size 10 gigabytes, you can specify 10G, or 10240M, or 10485760K, 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.

  • Specify the multipart name of the storage volume snapshot if you are creating a storage volume from a colocated storage snapshot.
  • Account of the parent snapshot from which the storage volume is restored.
  • 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

    Strings that you can use to tag the storage volume.

Nested Schema : properties
Type: 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.

Show Source
Nested Schema : tags
Type: array

Strings that you can use to tag the storage volume.

Show Source

Response

Supported Media Types

201 Response

Created. See Status Codes for information about other possible HTTP status codes.
Headers
Body ()
Root Schema : StorageVolume-response
Type: object
Show Source
Nested Schema : properties
Type: array
The storage-pool property: /oracle/public/storage/latency or /oracle/public/storage/default.
Show Source
Nested Schema : tags
Type: array
Comma-separated strings that tag the storage volume.
Show Source

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.