Modifying a Volume
You can modify the attributes of an existing volume, whether it is the root device where the operating system of the virtual machine (VM) is installed, or a secondary volume of the VM. This action is available regardless of the volume’s state or the operating system (OS) of the VM it is attached to.
You can use this action to resize the volume, change its type, or update its number of I/O operations per second (IOPS).
Modifying a Volume with OSC CLI
The UpdateVolume command modifies the specified attributes of a volume.
When the modification is not instantaneous, the response displays the previous value. You can use the ReadVolumeUpdateTasks method to see the progression of the update. |
$ osc-cli api UpdateVolume --profile "default" \
--VolumeId "vol-12345678" \
--Size 50
$ osc-cli api UpdateVolume --profile "default" \
--VolumeId "vol-12345678" \
--VolumeType "io1" \
--Iops 200
This command contains the following attributes that you need to specify:
-
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
Iops
: (optional) The new number of I/O operations per second (IOPS). This parameter can be specified only if you update anio1
volume or if you change the type of the volume for anio1
. -
Size
: (optional) The new size of the volume, in gibibytes (GiB). This value must be equal to or greater than the current size of the volume. This modification is not instantaneous. -
VolumeId
: The ID of the volume you want to update. -
VolumeType
: (optional) The new type of the volume (standard
|io1
|gp2
). If you update to anio1
volume, you must also specify theIops
parameter.
The UpdateVolume command returns the following elements:
-
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
-
Volume
: Information about the volume.-
ClientToken
: The idempotency token provided when creating the volume. -
CreationDate
: The date and time (UTC) at which the volume was created. -
Iops
: The number of I/O operations per second (IOPS):-
For
io1
volumes, the number of provisioned IOPS -
For
gp2
volumes, the baseline performance of the volume
-
-
LinkedVolumes
: Information about your volume attachment.-
DeleteOnVmDeletion
: If true, the volume is deleted when terminating the VM. If false, the volume is not deleted when terminating the VM. -
DeviceName
: The name of the device. -
State
: The state of the attachment of the volume (attaching
|detaching
|attached
|detached
). -
VmId
: The ID of the VM. -
VolumeId
: The ID of the volume.
-
-
Size
: The size of the volume, in gibibytes (GiB). -
SnapshotId
: The snapshot from which the volume was created. -
State
: The state of the volume (creating
|available
|in-use
|deleting
|error
). -
SubregionName
: The Subregion in which the volume was created. -
Tags
: One or more tags associated with the volume.-
Key
: The key of the tag, with a minimum of 1 character. -
Value
: The value of the tag, between 0 and 255 characters.
-
-
TaskId
: The ID of the volume update task in progress. Otherwise, it is not returned. -
VolumeId
: The ID of the volume. -
VolumeType
: The type of the volume (standard
|gp2
|io1
).
-
{
"Volume": {
"VolumeId": "vol-12345678",
"Tags": [],
"VolumeType": "gp2",
"SubregionName": "eu-west-2a",
"State": "available",
"CreationDate": "2010-10-01T12:34:56.789Z",
"Iops": 100,
"LinkedVolumes": [],
"Size": 10,
"TaskId": "vol-update-12345678"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
{
"Volume": {
"VolumeId": "vol-12345678",
"Tags": [],
"VolumeType": "io1",
"SubregionName": "eu-west-2a",
"State": "available",
"CreationDate": "2010-10-01T12:34:56.789Z",
"Iops": 200,
"LinkedVolumes": [],
"Size": 10,
"TaskId": "vol-update-12345678"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Modifying a Volume with oapi-cli
The UpdateVolume command modifies the specified attributes of a volume.
When the modification is not instantaneous, the response displays the previous value. You can use the ReadVolumeUpdateTasks method to see the progression of the update. |
$ oapi-cli --profile "default" UpdateVolume \
--VolumeId "vol-12345678" \
--Size 50
$ oapi-cli --profile "default" UpdateVolume \
--VolumeId "vol-12345678" \
--VolumeType "io1" \
--Iops 200
This command contains the following attributes that you need to specify:
-
DryRun
: (optional) If true, checks whether you have the required permissions to perform the action. -
Iops
: (optional) The new number of I/O operations per second (IOPS). This parameter can be specified only if you update anio1
volume or if you change the type of the volume for anio1
. -
Size
: (optional) The new size of the volume, in gibibytes (GiB). This value must be equal to or greater than the current size of the volume. This modification is not instantaneous. -
VolumeId
: The ID of the volume you want to update. -
VolumeType
: (optional) The new type of the volume (standard
|io1
|gp2
). If you update to anio1
volume, you must also specify theIops
parameter.
The UpdateVolume command returns the following elements:
-
ResponseContext
: Information about the context of the response.-
RequestId
: The ID of the request.
-
-
Volume
: Information about the volume.-
ClientToken
: The idempotency token provided when creating the volume. -
CreationDate
: The date and time (UTC) at which the volume was created. -
Iops
: The number of I/O operations per second (IOPS):-
For
io1
volumes, the number of provisioned IOPS -
For
gp2
volumes, the baseline performance of the volume
-
-
LinkedVolumes
: Information about your volume attachment.-
DeleteOnVmDeletion
: If true, the volume is deleted when terminating the VM. If false, the volume is not deleted when terminating the VM. -
DeviceName
: The name of the device. -
State
: The state of the attachment of the volume (attaching
|detaching
|attached
|detached
). -
VmId
: The ID of the VM. -
VolumeId
: The ID of the volume.
-
-
Size
: The size of the volume, in gibibytes (GiB). -
SnapshotId
: The snapshot from which the volume was created. -
State
: The state of the volume (creating
|available
|in-use
|deleting
|error
). -
SubregionName
: The Subregion in which the volume was created. -
Tags
: One or more tags associated with the volume.-
Key
: The key of the tag, with a minimum of 1 character. -
Value
: The value of the tag, between 0 and 255 characters.
-
-
TaskId
: The ID of the volume update task in progress. Otherwise, it is not returned. -
VolumeId
: The ID of the volume. -
VolumeType
: The type of the volume (standard
|gp2
|io1
).
-
{
"Volume": {
"VolumeId": "vol-12345678",
"Tags": [],
"VolumeType": "gp2",
"SubregionName": "eu-west-2a",
"State": "available",
"CreationDate": "2010-10-01T12:34:56.789Z",
"Iops": 100,
"LinkedVolumes": [],
"Size": 10,
"TaskId": "vol-update-12345678"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
{
"Volume": {
"VolumeId": "vol-12345678",
"Tags": [],
"VolumeType": "io1",
"SubregionName": "eu-west-2a",
"State": "available",
"CreationDate": "2010-10-01T12:34:56.789Z",
"Iops": 200,
"LinkedVolumes": [],
"Size": 10,
"TaskId": "vol-update-12345678"
},
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Related Pages
Corresponding API Method