44 Storage Volume
A storage volume is virtual disk drive that provides block storage.
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-volume add
Creates a storage volume.
After creating storage volumes you can attach them to instances by using the storage-attachment add command.
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-volume add name properties size [--bootable] [--description description] [--imagelist imagelist] [--imagelist_entry imagelist_entry] [--snapshot snapshot] [--snapshot_id snapshot_id] [--snapshot_account snapshot_account] [--tags tags]
For help with the parameters and options of this command, run the command with the -h
option.
Example 1: Creating a Storage Volume
You can create a storage volume, a virtual disk that provides persistent block storage space for instances in Compute Classic. You can use such storage volumes to store data and applications. To create such a storage volume, you only need to specify values for the required parameters.
The following example demonstrates how to create a 10-GB storage volume named vol1
in the /Compute-acme/jack.jones@example.com
container.
opc -f json compute storage-volume add /Compute-acme/jack.jones@example.com/vol1 /oracle/public/storage/default 10G --description 'Accounting Department Block Storage' --tags 'Accounting Dept.'
Sample Output
{ "account": "/Compute-acme/default", "managed": true, "description": "Accounting Department Block Storage", "name": "/Compute-acme/jack.jones@example.com/vol1", "tags": ["Accounting Dept."], "bootable": false, "hypervisor": null, "quota": null, "uri": "https://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/dev1", "imagelist": null, "imagelist_entry": -1, "machineimage_name": null, "platform": null, "storage_pool": null, "writecache": false, "shared": false, "snapshot_id": null, "snapshot_account": null, "snapshot": null, "status": "Initializing", "status_detail": "The storage volume is currently being initialized.", "status_timestamp": "2016-07-17T11:15:24Z", "properties": [ "/oracle/public/storage/default" ], "size": "10737418240" }
Example 2: Creating a Bootable Storage Volume
The following example shows how to create a bootable storage volume, a storage volume that is associated with a machine image. 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. To create a bootable storage volume, in addition to specifying values for the required parameters, you must set bootable
to true
and specify a value for the imagelist
parameter. If you don’t specify the imagelist_entry
parameter, the default image list entry is considered.
The following example demonstrates how to create a bootable storage volume called /Compute-acme/jack.jones@example.com/vol2
by associating the storage volume with the /oracle/public/oel_6.4_2GB
image list.
opc -f json compute storage-volume add /Compute-acme/jack.jones@example.com/vol2 /oracle/public/storage/default 20G --description 'Accounting Department Bootable Block Storage' --tags 'Accounting Dept.' --bootable --imagelist /oracle/public/oel_6.4_2GB
Sample Output
{ "account": "/Compute-acme/default", "bootable": true, "description": "Accounting Department Block Storage", "hypervisor": null, "imagelist": "/oracle/public/oel_6.4_2GB", "imagelist_entry": 1, "machineimage_name": "/oracle/public/oel_6.4_2GB", "managed": true, "name": "/Compute-acme/jack.jones@example.com/vol2", "platform": "linux", "properties": [ "/oracle/public/storage/default" ], "quota": null, "shared": false, "size": "10737418240", "snapshot": null, "snapshot_account": null, "snapshot_id": null, "status": "Initializing", "status_detail": "The storage volume is currently being initialized.", "status_timestamp": "2017-02-08T06:20:02Z", "storage_pool": null, "tags": [ "Accounting Dept." ], "uri": "https://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/vol2", "writecache": false }
While creating an instance, you can specify a bootable storage volume as a persistent boot disk for the instance.
Example 3: Restoring a Storage Volume from a Storage Snapshot
While restoring a storage volume from a storage snapshot, take care of the following points:
-
The
property
value you specify for the restored volume must be compatible with the property value of the storage snapshot from which you are restoring the volume. -
The size of the restored storage volume must be equal to or more than the size of the storage snapshot.
-
If the storage snapshot is associated with a machine image, it indicates this is a snapshot of a bootable storage volume. While restoring the storage volume from such a snapshot, specify the
bootable
parameter.
To retrieve information about a storage snapshot, see storage-snapshot get.
The following example shows how to restore a storage volume /Compute-acme/jack.jones@example.com/restored-volume1
from a storage snapshot /Compute-acme/jack.jones@example.com/vol1/264fb75d47b40dcfc91303ea16912b73fd60dd65697989281630b362e2436205
.
opc -f json compute storage-volume add /Compute-acme/jack.jones@example.com/restored-volume1 /oracle/public/storage/default 20G --snapshot /Compute-acme/jack.jones@example.com/vol1/264fb75d47b40dcfc91303ea16912b73fd60dd65697989281630b362e2436205
Sample Output
{ "managed": true, "status_timestamp": "2016-09-28T10:49:07Z", "snapshot_account": null, "machineimage_name": null, "snapshot_id": "264fb75d47b40dcfc91303ea16912b73fd60dd65697989281630b362e2436205", "imagelist": null, "writecache": false, "size": "21474836480", "platform": null, "storage_pool": "/uabc2z3c/lmnis09-v1_multipath/storagepool/iscsi/thruput_1", "shared": false, "status": "Initializing", "description": null, "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/restored-volume1", "bootable": false, "hypervisor": null, "uri": "http://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/restored-volume1", "imagelist_entry": -1, "snapshot": "/Compute-acme/jack.jones@example.com/vol1/264fb75d47b40dcfc91303ea16912b73fd60dd65697989281630b362e2436205" }
storage-volume list
Retrieves details of the storage volumes that are in the specified container and match the specified query criteria. You can pass one or more query parameters to filter the search results. If you don't specify any query criteria, then details of all the storage volumes 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-volume list container [--name name] [--tags tags]
For help with the parameters and options of this command, run the command with the -h
option.
Example
This command retrieves the name and size of all the storage volumes in the /Compute-acme/jack.jones@example.com
container.
opc -f table -F name,status compute storage-volume list /Compute-acme/jack.jones@example.com
Sample Output
+---------------------------------------------------------------+--------+ NAME | STATUS +---------------------------------------------------------------+--------+ /Compute-acme/jack.jones@example.com/restoredVol1 | Error /Compute-acme/jack.jones@example.com/vol1 | Online /Compute-acme/jack.jones@example.com/vol2 | Online +---------------------------------------------------------------------+--------+
storage-volume discover
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-volume discover container
For help with the parameters and options of this command, run the command with the -h
option.
Example
This command retrieves the names of the storage volumes in the /Compute-acme/jack.jones@example.com
container.
opc -f json compute storage-volume discover /Compute-acme/jack.jones@example.com
Sample Output
{ "result": [ /Compute-acme/jack.jones@example.com/dev-vol1 /Compute-acme/jack.jones@example.com/dev-vol2 /Compute-acme/jack.jones@example.com/prod-vol1 /Compute-acme/jack.jones@example.com/prod-vol2 ] }
storage-volume get
Retrieves information about the specified storage volume.
You can use the get
command to verify whether add
and update
operations were completed successfully. Use the -F
option (for example, -F name
) 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-volume get name
For help with the parameters and options of this command, run the command with the -h
option.
Example
This command retrieves details of the /Compute-acme/jack.jones@example.com/dev-vol1
volume.
opc -f json compute storage-volume get /Compute-acme/jack.jones@example.com/dev-vol1
Sample Output
{ "status": "Online", "account": "/Compute-acme/default", "managed": true, "description": null, "name": "/Compute-acme/jack.jones@example.com/dev-vol1", "tags": [], "bootable": false, "hypervisor": null, "quota": "null", "uri": "https://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/dev-vol1", "imagelist_entry": 0, "storage_pool": "/root/storagepools/computepool", "machineimage_name": null, "status_timestamp": "2015-10-09T08:51:29Z", "shared": false, "imagelist": null, "status_detail": "The storage volume is online.", "writecache": false, "properties": [ "/oracle/public/storage/default" ], "size": "10737418240" }
storage-volume update
Updates a storage volume.
Although you have to pass values for several parameters, you can only increase the size of the storage volume and modify the values for the tags
and description
parameters. You must specify all the required fields, although these fields won't be updated.
You can update an existing storage volume to increase the capacity dynamically, even when the volume is attached to an instance. After increasing the size of the storage volume that is attached and mounted on an instance, log in to the instance, and then resize the file system. See Increasing the Size of a Storage Volume in Using Oracle Cloud Infrastructure Compute 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-volume update name properties size [--description description] [--tags tags]
For help with the parameters and options of this command, run the command with the -h
option.
Example
This command updates the size of the storage volume named /Compute-acme/jack.jones@example.com/vol1
from 10 GB to 20 GB and updates the description.
opc -f json compute storage-volume update /Compute-acme/jack.jones@example.com/vol1 /oracle/public/storage/default 20G --description 'Increased storage for Accounting Department' --tags 'Accounting Department'
Sample Output
{ "account": "/Compute-acme/default", "bootable": false, "description": "Increased storage for Accounting Department", "hypervisor": null, "imagelist": null, "imagelist_entry": -1, "machineimage_name": null, "managed": true, "name": "/Compute-acme/jack.jones@example.com/vol1", "platform": null, "properties": [ "/oracle/public/storage/default" ], "quota": null, "shared": false, "size": "21474836480", "snapshot": null, "snapshot_account": null, "snapshot_id": null, "status": "Updating", "status_detail": "The storage volume is currently being updated.", "status_timestamp": "2017-02-08T16:24:29Z", "storage_pool": "/ucfc2z3c/u1dis01nas09-v1_multipath/storagepool/iscsi/thruput_1", "tags": [ "Accounting Department" ], "uri": "http://api-z999.compute.us0.oraclecloud.com/storage/volume/Compute-acme/jack.jones@example.com/vol1", "writecache": false }
storage-volume delete
Deletes the specified storage volume. No response is returned.
Note that to delete storage volumes that are attached to instances, you must first detach them by using the storage-attachment delete command.
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-volume delete name
For help with the parameters and options of this command, run the command with the -h
option.
Example
This command deletes the /Compute-acme/jack.jones@example.com/vol1
volume.
opc compute storage-volume delete /Compute-acme/jack.jones@example.com/vol1