Managing Block Volumes

You can manage these aspects of block volumes:

  • List the block volumes in a compartment.
  • List the details of a block volume.
  • List block volume attachments.
  • Edit the volume's configuration.
  • Move a volume to another compartment.
  • Clone a volume.
  • Detach a volume.
  • Delete a volume.

Listing Block Volumes and Block Volume Details

You can list all block volumes in a specific compartment, and detailed information about a single volume.

Using the Compute Web UI

  1. In the navigation menu, under Block Storage, click Block Volumes.

  2. Select the appropriate compartment.

  3. To view block volume details, click the name of the block volume.

    The details are displayed.

    Detail Item Description
    Block volume icon

    Displays the status of the block volume.

    Block volume name

    The name of the block volume.

    Block Volume Information and Tags

    Tabs that you can click to display:

    • General Information

    • Tags that have been applied to this object

    Created

    The day and time that the volume was created.

    Compartment

    The compartment that the volume belongs to.

    OCID

    The volume's Oracle Cloud ID.

    Backup Policy

    The backup policy assigned to the volume.

    Size

    The size of the volume.

    High Performance Enabled

    Whether the volume is configured as a high performance volume, and the volume performance units (VPUs) per GB.

Using the OCI CLI

  1. Get the OCID of the compartment where you want to list block volumes: (oci iam compartment list)

  2. Run the volume list command.

    $ oci bv volume list --compartment-id ocid1.compartment.unique_ID
    {
      "data": [
        {
          "auto-tuned-vpus-per-gb": null,
          "availability-domain": "AD-1",
          "compartment-id": "ocid1.compartment.unique_ID",
          "defined-tags": {},
          "display-name": "volume2",
          "freeform-tags": {},
          "id": "ocid1.volume.unique_ID",
          "is-auto-tune-enabled": null,
          "is-hydrated": null,
          "kms-key-id": null,
          "lifecycle-state": "AVAILABLE",
          "size-in-gbs": 52,
          "size-in-mbs": 53248,
          "source-details": null,
          "system-tags": null,
          "time-created": "2021-06-01T17:33:24+00:00",
          "volume-group-id": null,
          "vpus-per-gb": 20
        },
        {
          "auto-tuned-vpus-per-gb": null,
          "availability-domain": "AD-1",
          "compartment-id": "ocid1.compartment.unique_ID",
          "defined-tags": {},
          "display-name": "volume20210106171509",
          "freeform-tags": {},
          "id": "ocid1.volume.unique_ID",
          "is-auto-tune-enabled": null,
          "is-hydrated": null,
          "kms-key-id": null,
          "lifecycle-state": "AVAILABLE",
          "size-in-gbs": 50,
          "size-in-mbs": 51200,
          "source-details": null,
          "system-tags": null,
          "time-created": "2021-06-01T17:15:09+00:00",
          "volume-group-id": null,
          "vpus-per-gb": 10
        },
    }

    The is-hydrated value is always null because this property does not apply to Private Cloud Appliance.

    Private Cloud Appliance does not support volume performance auto-tuning.

    To list only a specific block volume, use the get command:

    $ oci bv volume get --volume-id ocid1.volume.unique_ID

    Any backup policy that is assigned to a volume is not shown in the volume list or get output. Use the following command to show the OCID of the backup policy for a volume:

    $ oci bv volume-backup-policy-assignment get-volume-backup-policy-asset-assignment \
    --asset-id ocid1.volume.unique_ID
    {
      "data": [
        {
          "asset-id": "ocid1.volume.unique_ID",
          "id": "ocid1.backuppolicyassignment.unique_ID",
          "policy-id": "ocid1.volumebackuppolicy.unique_ID",
          "time-created": "2023-06-07T02:03:53.466062+00:00"
        }
      ]
    }

Listing Block Volume Attachments

Using the Compute Web UI

  1. In the navigation menu, click Compute, then click Instances.

  2. Select the compartment where the instance resides.

  3. Click the instance name to display the details.

  4. Scroll to the Resources section and select Attached Block Volumes.

    Block volumes that are attached to this instance are listed in the table.

  5. To see details for a block volume, click the block volume name.

Using the OCI CLI

List block volume attachments for all instances in a compartment.

  1. Get the OCID of the compartment where you want to list instance block volume attachments: (oci iam compartment list)

  2. Run the volume attachment list command.

    $ oci compute volume-attachment list \
    --compartment-id oocid1.compartment.unique_ID
    {
      "data": [
        {
          "attachment-type": "paravirtualized",
          "availability-domain": "AD-1",
          "compartment-id": "ocid1.compartment.unique_ID",
          "device": null,
          "display-name": "volumeattachment20210106172413",
          "id": "ocid1.volumeattachment.unique_ID",
          "instance-id": "ocid1.instance.unique_ID",
          "is-multipath": null,
          "is-pv-encryption-in-transit-enabled": null,
          "is-read-only": false,
          "is-shareable": false,
          "iscsi-login-state": null,
          "lifecycle-state": "ATTACHED",
          "time-created": "2021-06-01T17:24:13+00:00",
          "volume-id": "ocid1.volume.unique_ID"
        },
        {
          "attachment-type": "paravirtualized",
          "availability-domain": "AD-1",
          "compartment-id": "ocid1.compartment.unique_ID",
          "device": null,
          "display-name": "volumeattachment20210106175003",
          "id": "ocid1.volumeattachment.unique_ID",
          "instance-id": "ocid1.instance.unique_ID",
          "is-multipath": null,
          "is-pv-encryption-in-transit-enabled": null,
          "is-read-only": false,
          "is-shareable": false,
          "iscsi-login-state": null,
          "lifecycle-state": "ATTACHED",
          "time-created": "2021-06-01T17:50:03+00:00",
          "volume-id": "ocid1.volume.unique_ID"
        }
      ]
    }

    To list only block volume attachments for a specific instance, specify the instance OCID.

    $ oci compute volume-attachment list --instance-id ocid1.instance.unique_ID

    To list block volume attachments for a specific volume, specify the volume OCID in addition to either the compartment OCID or the instance OCID.

    $ oci compute volume-attachment list \
    --compartment-id oocid1.compartment.unique_ID \
    --volume-id ocid1.volume.unique_ID

    To list a specific block volume attachment, specify the volume attachment OCID.

    $ oci compute volume-attachment get \
    --volume-attachment-id ocid1.volumeattachment.unique_ID

Editing a Volume's Configuration

You can change settings for your block volumes and boot volumes while the volumes are online, without any downtime. You can change the display name, increase the size, and change tags.

Using the Compute Web UI

  1. In the navigation menu, under Block Storage, click Block Volumes.

  2. Select the compartment where the block volume resides.

  3. For the volume that you want to edit, click the Actions menu and then click Edit.

  4. In the Edit Block Volume dialog, make the changes.

    • Name: The volume display name. The name does not have to be unique.

    • Size (in GB): You can increase the size in 1 GB increments up to 32768 (32 TB). You cannot decrease the size. Before you change the size, see Resizing Volumes to understand the effects of this change.

    • Tagging: Add, remove, or change tags. For details about tagging, see Working with Resource Tags.

  5. Click Save Changes.

Using theOCI CLI

  1. Get the OCID of the volume that you want to update: (oci bv volume list)

  2. Run the volume update command.

    Syntax:

    oci bv volume update --volume-id volume_OCID \
    options_with_values_to_update

    For descriptions of properties that you can change, enter the following command and scroll to Optional Parameters:

    $ oci bv volume update -h

    VPUs per GB cannot be changed after the volume is created. To update the logBias or secondaryCache values, see the instructions in Creating a Block Volume.

    Example:

    $ oci bv volume update --volume-id ocid1.volume.unique_ID \
    --display-name volumeA --size-in-gbs 100

Moving a Volume to a Different Compartment

You can move Block Volume resources such as block volumes, boot volumes, clones, volume backups, volume groups, and volume group backups from one compartment to another.

When you move a resource to a new compartment, associated resources might not be moved. For example, when you move a block volume, any backups of that volume are not moved.

Important:

Any access policies that exist on the new compartment apply immediately. Before you move resources to a different compartment, ensure that the resource users have sufficient access permissions on the compartment the resource is being moved to.

  • You cannot move a block volume or boot volume from a security zone to a standard compartment.

  • You cannot move a volume from a standard compartment to a compartment that is in a security zone if the volume violates any security zone policies.

Using the OCI CLI

  1. Gather the information that you need to run the command:

    • Volume OCID (oci bv volume list)

    • Target Compartment OCID (oci iam compartment list)

  2. Run the change compartment command.

    Example:

    oci bv volume change-compartment \
    --volume-id ocid1.volume.uniqueID \
    --compartment-id ocid1.compartment.uniqueID
    {
      "etag": "7e084c71-4729-4ddd-b131-d87bfc621e8c"
    }

Cloning a Block Volume

Cloning a block volume enables you to make a copy of an existing block volume without performing the backup and restore operations.

A cloned volume is a point-in-time direct disk-to-disk deep copy of the source volume. All the data that is in the source volume is copied to the clone volume. Any subsequent changes to the data on the source volume are not copied to the clone.

By default, the clone is the same size as the source volume. You can specify a larger volume size when you create the clone.

The volume data is being copied in the background, and can take up to thirty minutes, depending on the size of the volume. You can attach and use the cloned volume as a regular volume when the state changes to Available.

For more information about cloning volumes, refer to "Volume Backups and Clones" in the Block Volume Storage Overview chapter in the Oracle Private Cloud Appliance Concepts Guide.

Using the Compute Web UI

  1. In the navigation menu, under Block Storage, click Block Volumes.

  2. Select the appropriate compartment.

  3. For the volume you want to clone, click the Actions menu and then click Create Clone.

  4. In the dialog, enter the following information:

    • Name: A name or description for the volume. Avoid entering confidential information.

    • Compartment: Select the compartment in which to clone the block volume.

    • Size (in GBs): You can keep the size the same, or increase the size in 1 GB increments up to 32 TB. You cannot decrease the size.

    • High-Performance Volume:(Optional) By default, the clone has the same performance setting as the source volume. Use this button to change the performance setting for this clone. For more information, see "Block Volume Performance Options" in the Block Volume Storage Overview chapter in the Oracle Private Cloud Appliance Concepts Guide.

    • Backup Policy:(Optional) Select a backup policy from the drop-down list. You might need to change the compartment.

      Oracle defined policies are listed, as well as any user defined policies. For information about Oracle defined policies (bronze, silver, and gold), see "Volume Backups and Clones" in the Block Volume Storage Overview chapter in the Oracle Private Cloud Appliance Concepts Guide.

      Backup policies can be assigned or changed after the volume is cloned, or you can back up this volume manually. A volume can only have only one volume backup policy assigned at a time. For information about creating, editing, and assigning backup policies, see Managing Backup Policies. You can also back up this volume manually as described in Creating a Manual Boot or Block Volume Backup.

    • Tagging:(Optional) Add defined or free-form tags for this instance as described in Adding Tags at Resource Creation. Tags can also be applied later.

  5. Click Create Clone.

Using the OCI CLI

To clone a block volume, create a new block volume, specifying the volume that you want to clone as the source volume.

  1. Gather the information that you need to run the command:

    • Compartment OCID that contains the source volume (oci iam compartment list)

    • Volume OCID of the volume to clone (oci bv volume list)

  2. Run the volume create command, specifying the volume to clone.

    Syntax:

    oci bv volume create --availability-domain AD-1 \
    --compartment-id compartment_OCID \
    --source-volume-id OCID_of_volume_to_clone

    Example:

    $ oci bv volume create --availability-domain AD-1 -c ocid1.compartment.unique_ID \
    --source-volume-id ocid1.volume.unique_ID --display-name "MyVolumeClone"
    {
      "data": {
        "auto-tuned-vpus-per-gb": null,
        "autotune-policies": null,
        "availability-domain": "AD-1",
        "block-volume-replicas": null,
        "compartment-id": "ocid1.compartment.unique_ID",
        "defined-tags": {},
        "display-name": "MyVolumeClone",
        "freeform-tags": {},
        "id": "ocid1.volume.unique_ID",
        "is-auto-tune-enabled": null,
        "is-hydrated": null,
        "kms-key-id": null,
        "lifecycle-state": "PROVISIONING",
        "size-in-gbs": 51,
        "size-in-mbs": 52224,
        "source-details": {
          "id": "ocid1.volume.unique_ID",
          "type": "volume"
        },
        "system-tags": null,
        "time-created": "2023-06-07T17:34:34.234713+00:00",
        "volume-group-id": null,
        "vpus-per-gb": 20
      },
      "etag": "b9c13787-91a5-41ca-aa49-12e3ff80e97a",
      "opc-work-request-id": "ocid1.workrequest.unique_ID"
    }

Detaching a Block Volume

When an instance no longer needs access to a volume, you can detach the volume from the instance without affecting the volume's data.

Caution:

If you later reattach the detached volume, the volume might be associated with a different device name and the instance operating system might not recognize the volume.

Using the Compute Web UI

  1. Perform administrative tasks to remove any dependencies that any instances have for the block volume.

    For example, ensure that no applications are accessing the volume. Unmount the volume and remove it from the /etc/fstab file, and so on.

  2. In the navigation menu, click Compute, then click Instances.

  3. Select the compartment where the instance resides.

  4. In the Instances list, click the instance that has the volume attached.

  5. In the lower left corner, under Resources, select Attached Block Volumes.

  6. Click the Actions icon (three dots) next to the volume you want to detach, and then click Detach.

  7. Confirm when prompted.

Using the OCI CLI

  1. Get the volume attachment OCID (oci compute volume-attachment list)

  2. Run the detach command.

    Syntax:

    oci compute volume-attachment detach --volume-attachment-id volume_attachment_OCID

    Example:

    oci compute volume-attachment detach --volume-attachment-id ocid1.volumeattachment.uniqueID
    Are you sure you want to delete this resource? [y/N]: y

    To avoid the confirmation prompt, use the --force option.

Deleting a Block Volume

You can delete a volume that is no longer needed.

Caution:

You cannot undo this operation. Any data on a volume is permanently deleted when the volume is deleted.

Caution:

All policy-based (scheduled) backups expire. A manual backup expires if a scheduled backup of the same volume is created after the manual backup was created. To keep a volume backup indefinitely, cancel all future scheduled backups and create a manual backup before you delete the source volume. See Backing Up Block Volumes.

The result of deleting a block volume differs depending on thee following conditions:

  • The volume has no backups or clones: The volume is immediately deleted and the volume capacity is returned to the system for reuse. The volume is marked TERMINATED and eventually is no longer listed.
  • The volume has a backup or a clone: The volume is marked TERMINATED, but the volume is not deleted and the capacity is not returned to the system until all of the backups and clones of the volume are deleted.
  • The volume is part of a DR configuration and replicating: The volume is marked TERMINATED, but the volume is not deleted and the capacity is not returned to the system until DR completes the replication.

Using the Compute Web UI

  1. Perform administrative tasks to remove any dependencies that any instances have for the block volume.

    For example, ensure that no applications are accessing the volume. Unmount the volume and remove it from the /etc/fstab file, and so on.

  2. In the navigation menu, under Block Storage, click Block Volumes.

  3. Select the compartment that contains the block volume that you plan to delete.

  4. For the volume you plan to delete, click the Actions menu and then click Terminate.

  5. Confirm the termination when prompted.

Using the OCI CLI

  1. Get the volume OCID (oci bv volume list)

  2. Run the volume delete command.

    Example:

    $ oci bv volume delete --volume-id ocid1.volume.uniqueID
    Are you sure you want to delete this resource? [y/N]: y
    {
      "etag": "bd576de7-3193-4171-9792-uniqueID"
    }

    To avoid the confirmation prompt, use the --force option.