Attaching a Volume to Multiple Instances

The Oracle Cloud Infrastructure Block Volume service provides the capability to attach a block volume to multiple Compute instances. With this feature, you can share block volumes across instances in read/write or read-only mode. Attaching block volumes as read/write and shareable enables you to deploy and manage your cluster-aware solutions.

This topic describes how to attach block volumes as shareable, along with the limits and considerations for this feature.

See Volume Access Types for more information about the available access type options. For attaching volumes to single instances, see Attaching a Volume.

Limits and Considerations

  • The Block Volume service does not provide coordination for concurrent write operations to block volumes attached to multiple instances, so if you configure the block volume as read/write and shareable you must deploy a cluster aware system or solution on top of the shared storage, see Configuring Multiple Instance Volume Attachments with Read/Write Access.

  • Once you attach a block volume to an instance as read-only, it can only be attached to other instances as read-only. If you want to attach the block volume to an instance as read/write, you need to detach the block volume from all instances and then you can reattach the block volume to instances as read/write.

  • If the block volume is already attached to an instance as read/write non-shareable you can't attach it to another instance until you detach it from the first instance. You can then reattach it to both the first and second instances as read/write shareable.

  • You can't delete a block volume until it has been detached from all instances it was attached to. When viewing the instances attached to the block volume from the Resources section of the Volume Details page, you should note that only instances in the selected compartment will be displayed. You may need to change the compartment to list additional instances that are attached to the volume.

  • You can attach a block volume as read/write shareable or read-only shareable up to a maximum of eight instances.

  • Block volumes attached as read-only are configured as shareable by default.

  • Performance characteristics described in Block Volume Performance are per volume, so when a block volume is attached to multiple instances the performance is shared across all the attached instances.

Configuring Multiple Instance Volume Attachments with Read/Write Access

The Block Volume service does not provide coordination for concurrent write operations to volumes attached to multiple instances. To prevent data corruption from uncontrolled read/write operations you must install and configure a cluster aware system or solution such as Oracle Cluster File System version 2 (OCFS2) on top of the shared storage before you can use the volume.

You can see an sample walkthrough of scenario using OCFS2 described in Using the Multiple-Instance Attach Block Volume Feature to Create a Shared File System on Oracle Cloud Infrastructure. The summary of the required steps for this scenario are:

  1. Attach the block volume to an instance as Read/Write-Shareable using the Console, CLI, or API.

  2. Set up your OCFS2/O2CB cluster nodes.

  3. Create your OCFS2 file system and mount point.

Required IAM Policy

To use Oracle Cloud Infrastructure, you must be given the required type of access in a policy  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 compartment  you should work in.

For administrators: The policy in Let users launch Compute 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. For reference material about writing policies for instances, cloud networks, or other Core Services API resources, see Details for the Core Services.

Using the Console

To attach a volume to multiple instances from the Instance details page
To attach a volume to multiple instances from the Block Volume details page
To view the instances attached to a volume from the Volume details page
To view the volumes attached to an instance from the Instance details page

Using the CLI

For information about using the CLI, see Command Line Interface (CLI).

To attach a volume to an instance as shareable, read/write
To list all the instances attached to a volume

Using the API

Use the following APIs to attach volumes and work with volume attachments to instances:

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.