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 still 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 intances.

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 and backups 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, select the instance you want to attach to the volume.

  3. Click the name of the instance to display the instance details.

  4. In the Resources section on the Instance Details page, click Attached Block Volumes.

  5. Click Attach Block Volume.

  6. Select the volume attachment type, iSCSI or PARAVIRTUALIZED.

    For more information, see Volume Attachment Types.

  7. Select the compartment from the Block Volume Compartment drop-down menu.

  8. If the image the instance was created from supports consistent device paths, you can optionally select a device path from the DEVICE PATH drop-down.

    For all instances launched from Linux-based images released before November 2018 or Windows images, this option is not available. See Connecting to Volumes With Consistent Device Paths for more information about this feature and a list of the image versions that support it.

    For Linux-based instances created from images released in November, but launched prior to January 11th, 2018, this option is also not available. See Device path option not available for instances launched before January 11th, 2019 for more information.

  9. Select the access type, READ/WRITE or READ-ONLY.

    For more information, see Volume Access Types.

  10. Select the volume you want from the Volume drop-down menu.

  11. For paravirtualized volume attachments on virtual machine (VM) instances you can optionally check Use in-transit encryption if you want to encrypt data transferred between the instance and the Block Volume service storage servers. 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 will be used. See Block Volume Encryption for more information.

  12. Click Attach.

    Once the volume's icon no longer lists it as Attaching, you can use the volume if the attachment type is Paravirtualized. 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 mount automatically 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.