Listing Attachments for a Block Volume

Learn how to view a list all volume attachments in a specific compartment, as well as detailed information on a single volume attachment.

Required IAM Policy

To use Oracle Cloud Infrastructure, an administrator must be a member of a group granted security access in a policy  by a tenancy administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don't have permission or are unauthorized, verify with the tenancy administrator what type of access you have and which compartment  your access works in.

For administrators: The policy in Let users launch compute instances includes the ability to list volume attachments. The policy in Let volume admins manage block volumes, backups, and volume groups lets the specified group do everything with block volumes and backups, but not launch instances.

If you're new to policies, see Managing Identity Domains and Common Policies. For reference material about writing policies for instances, cloud networks, or other Core Services API resources, see Details for the Core Services.
    1. On the Block Volumes list page, select the volume that you want. If you need help finding the list page or the volumes, see Listing Volumes.
    2. On the details page, select Attached Instances.

    All of the block volume's attached instances in the selected compartment are displayed in the list.

    Note

    To view volume attachments from Compute:
    1. On the Compute Instances list page, select the instance that you want to view. If you need help finding the list page, see Listing Instances.
    2. On the details page, perform one of the following actions depending on the option that you see:
      • Select Storage and then scroll down to Attached block volumes.
      • Select Attached Block Volumes.

    All block volumes attached to the instance are displayed in the list, regardless of the compartment the block volumes are in.

  • Use the oci compute volume-attachment list command and specify the required parameters to list volume attachments.

    To view volume attachments in a compartment:

    oci compute volume-attachment list --compartment-id compartment_id [OPTIONS]
    Note

    This operation only returns the attached instances that are in the specified compartment. You must run this operation for every compartment that might contain instances that are attached to the specified volume.

    To view volume attachments for an instance:

    oci compute volume-attachment list --instance-id instance_id [OPTIONS]

    For a complete list of parameters and values for CLI commands, see the CLI Command Reference.

  • Run the ListVolumeAttachments operation and specify the compartmentId attribute to view a list of a volume attachments in a compartment. To filter the list, also specify one or both of the following parameters: instanceId or volumeId.

    Note

    • This operation returns attached instances in the compartment you specify. To return all attached instances for the volume, run this operation for every compartment that might contain instances.
    • To get detailed information on a single attachment, use GetVolumeAttachment.