Skip to content

Storage / Task

Find the instance a volume is attached to

Updated · 2 min read

Follow an INUSE volume's claimRef to its volume attachment and from there to the instance that holds it, with one CLI command or API query.

On this page5 sections

A volume that reports INUSE names what holds it in claimRef: the id of a volume attachment. Follow that attachment to find the instance, for example before you detach the volume to delete it.

Before you begin

Find the instance

  1. Read the volume’s claimRef.

    terminal
    origin storage get-volume --volume-urn <volume-urn>
  2. List the attachments that reference the volume.

    terminal
    origin compute list-volume-attachments \
      --project-urn <project-urn> --volume-urn <volume-urn>

    With the API, use the volumeAttachments query:

    GraphQL
    query {
      compute {
        volumeAttachments(input: {
          projectUrn: "<project-urn>"
          volumeUrn: "<volume-urn>"
        }) {
          id
          instanceUrn
          deviceName
          status
        }
      }
    }
  3. Take the entry whose id equals the volume’s claimRef. Its instanceUrn is the instance, and deviceName is the device name the guest sees.

  4. Confirm by reading the instance. Its volumeAttachments include the volume.

    terminal
    origin compute get-instance --instance-urn <instance-urn>

Reading the attachment list

Normally the list has one entry, with status ATTACHED. Other entries appear while an attach or detach is in progress and after an attach that FAILED. An entry with status RELEASE_ABANDONED may still hold the volume: the platform has stopped trying to release it. Detached attachments aren’t listed.

A volume from another project returns an empty list, exactly like a volume that doesn’t exist.

Next steps