Detaching a Volume

Detach a block volume from an instance.

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

    For volumes attached using iSCSI, we recommend that you unmount and disconnect the volume from the instance using iscsiadm before you detach the volume. Failure to do so might lead to loss of data. See Disconnecting From a Volume for more information.
    1. On the Instances list page, select the instance you want to detach a volume from. If you need help finding the list page or the instance, 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.
    3. From the Actions menu (three dots) for the block volume you want to detach, select Detach.
    4. Select Detach volume.
  • Use the oci compute volume-attachment detach command and required parameters to detach a block volume from an instance:

    oci compute volume-attachment detach --volume-attachment-id volume_attachment_ocid [OPTIONS]

    For a complete list of flags and variable options for CLI commands, see the Command Line Reference.

  • Run the DetachVolume operation and specify the volumeAttachmentId attribute to detach a block volume from an instance.