Oracle Cloud Infrastructure Documentation

Attaching a Volume

You can Link a volume and instance together. Allows an instance to connect and mount the volume as a hard drive. a volume to an instance in order to expand the available storage on the instance. If you specify iSCSI as the volume attachment type, you must also connect and mount the volume from the instance for the volume to be usable. For more information, see Volume Attachment Types and Connecting to a Volume.

Note

You should only attach Linux volumes to Linux instances and Windows volumes to Windows instances.

Required IAM Policy

To use Oracle Cloud Infrastructure, you must be given the required type of access in a An IAM document that specifies who has what type of access to your resources. It is used in different ways: to mean an individual statement written in the policy language; to mean a collection of statements in a single, named "policy" document (which has an Oracle Cloud ID (OCID) assigned to it); and to mean the overall body of policies your organization uses to control access to resources. written by an administrator, whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you try to perform an action and get a message that you don’t have permission or are unauthorized, confirm with your administrator the type of access you've been granted and which A collection of related resources that can be accessed only by certain groups that have been given permission by an administrator in your organization. you should work in.

For administrators: The policy in Let users launch instances includes the ability to attach/detach existing block volumes. 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 Getting Started with Policies and Common Policies. If you want to dig deeper into writing policies for instances, cloud networks, or other Core Services API resources, see Details for the Core Services.

Using the Console

  1. Open the navigation menu. Under Core Infrastructure, go to Compute and click Instances.

  2. In the Instances list, click the instance that you want to attach a volume to.

  3. In the Resources section, click Attached Block Volumes.

  4. Click Attach Block Volume.

  5. Select the volume attachment type, iSCSI or Paravirtualized.

    For more information, see Volume Attachment Types.

  6. In the Block Volume Compartment drop-down list, select the compartment.

  7. In the Block Volume drop-down list, select the volume to attach.

  8. If the instance supports consistent device paths, a Device Path drop-down list is available. Select an optional device path that will remain consistent between instance reboots.

    For more information about this feature and the instances that support it, see Connecting to Volumes With Consistent Device Paths

  9. Select the access type, Read/Write or Read-only.

    For more information, see Volume Access Types.

  10. For paravirtualized volume attachments on virtual machine (VM) instances, you can optionally encrypt data that is transferred between the instance and the Block Volume service storage servers. To do this, select the Use in-transit encryption check box. If you configured the volume to use an encryption key that you manage using the Key Management service, this key is used for in-transit encryption. Otherwise, the Oracle-provided encryption key is used. See Block Volume Encryption for more information.

  11. Click Attach.

    When the volume's icon no longer lists it as Attaching, if the attachment type is Paravirtualized, you can use the volume. If the attachment type is iSCSI, you need to connect to the volume first. For more information, see Connecting to a Volume.

    On Linux-based instances, if you want to automatically mount volumes on instance boot, you need to set some specific options in the /etc/fstab file, or the instance may fail to launch. This applies to both iSCSI and paravirtualized attachment types. For volumes using consistent device paths, see /etc/fstab Options for Block Volumes Using Consistent Device Paths. For all other volumes, see /etc/fstab Options.

Using the API

To attach a volume to an instance, use the following operation:

For information about using the API and signing requests, see REST APIs and Security Credentials. For information about SDKs, see Software Development Kits and Command Line Interface.