Compute / task

Attach and detach volumes

Attach a volume to give an instance another disk. Detach it to move the disk and its data to another instance. The instance can be running or stopped.

Before you begin

  • An instance in RUNNING or STOPPED.
  • A volume in AVAILABLE status, in the same project and availability zone as the instance. See Create a volume.
  • The origin CLI, signed in. See CLI access.

Attach a volume

  1. Attach the volume:

    Terminal window
    origin compute attach-volume \
    --instance-urn <instance-urn> \
    --volume-urn <volume-urn>

    To choose the guest device name, add --device-name, for example --device-name vdb. Names run from vda to vdz, and vdc is reserved by the platform. Omitted, the platform assigns the first free name.

  2. Check the attachment’s status in the response, or in volumeAttachments from get-instance:

    Terminal window
    origin compute get-instance --instance-urn <instance-urn>
    • On a stopped instance, the attachment reads ATTACHED right away and the disk appears in the guest at the next start.
    • On a running instance, the disk is added live. The attachment reads ATTACHING, then ATTACHED once the guest sees the device. If the device can’t be added, it reads FAILED and the volume is released.
  3. Verify inside the guest that the disk is there, under the attachment’s deviceName:

    Terminal window
    lsblk

    A new volume has no file system. Create one before you mount it.

Detach a volume

  1. Unmount the file system inside the guest if the instance is running.

  2. Detach the volume:

    Terminal window
    origin compute detach-volume \
    --instance-urn <instance-urn> \
    --volume-urn <volume-urn>

    On a running instance the attachment reads DETACHING until the guest releases the device. If the guest doesn’t release it, the attachment returns to ATTACHED and the volume stays attached.

  3. Verify that the volume reads AVAILABLE:

    Terminal window
    origin storage get-volume --volume-urn <volume-urn>

    The attachment stays in the instance’s volumeAttachments history as DETACHED, with its volume reference cleared.

You can’t detach an instance’s root disk.

Using the API

The attachVolume and detachVolume mutations return the attachment:

mutation {
compute {
attachVolume(input: {
instanceUrn: "<instance-urn>"
volumeUrn: "<volume-urn>"
deviceName: "vdb"
}) {
urn
deviceName
status
}
}
}

If this fails

An attach is refused when the instance is neither running nor stopped, when the volume isn’t AVAILABLE, or when the device name you asked for is already taken. To find which instance holds a volume that reads INUSE, see Find the instance that holds a volume.

Origin Cloud — user documentation · last reviewed 2026-10-03 Legal notice Privacy policy