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 Block Volume to an Instance.

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 up to 32 instances to a shared volume if the volume is not configured for the Ultra High Performance level

  • Volumes configured for the Ultra High Performance level require multipath-enabled attachments. You can attach up to 25 instances with multipath-enabled attachments to a shared volume configured for Ultra High Performance. If you try to attach additional multipath-enabled attachments beyond 25, the attachment process will fail.

  • 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.

  • Volumes configured for the Ultra High Performance level can also be attached to multiple instances, however the total IOPS and throughput of all attachments combined, including those configured for Ultra High Performance and non-Ultra High Performance are capped at the limits for a volume. For more information, see Ultra High Performance and Configuring Attachments to Ultra High Performance Volumes.

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 granted security access in a policy  by an administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don't have permission or are unauthorized, verify with your administrator what type of access you have and which compartment  to 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

Using the CLI

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

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 API documentation and Security Credentials. For information about SDKs, see SDKs and the CLI.

Additional Resources

See the following links for example deployments of shared file systems on Oracle Cloud Infrastructure.

  • GitHub project for automated terraform deployment of BeeGFS: oci-beegfs

  • GitHub project for automated terraform deployment of Lustre: oci-lustre

  • GitHub project for automated terraform deployments of IBM Spectrum Scale (GPFS) distributed parallel file system on Oracle Cloud Infrastructure: oci-ibm-spectrum-scale