Attaching a Storage Volume to an Instance

You can provide or increase block storage capacity for an instance by attaching storage volumes.

To complete this task, you must have the Compute_Operations role. If this role isn’t assigned to you or you’re not sure, then ask your system administrator to ensure that the role is assigned to you in Oracle Cloud Infrastructure Classic Console. See Modifying User Roles in Managing and Monitoring Oracle Cloud.

  1. Sign in to the Compute Classic console. If your domain spans multiple sites, select the appropriate site. To change the site, click the Site menu near the top of the page.
  2. Click the Storage tab.
  3. Identify the storage volume that you want to attach. From the menu icon menu, select Attach Instance.
  4. Select the instance to which you want to attach the volume.
  5. The Attach as Disk # field is filled automatically with the next available index at which the volume can be attached. You can leave this field at the automatically selected disk number or enter a higher number up to 10.

    The disk number that you specify here determines the device name. The disk attached at index 1 is named /dev/xvdb, the disk at index 2 is /dev/xvdc, the disk at index 3 is /dev/xvdd, and so on.

    Make a note of the disk number. You’ll need it later when you mount the storage volume on the instance.

  6. Click Attach.

You can also attach a storage volume to a running instance from the Instances page. See Attaching a Storage Volume to an Instance.

To attach a storage volume to a running instance using the CLI, use the opc compute storage-attachment add command. For help with that command, run the command with the -h option. For the instructions to install the CLI client, see Preparing to Use the Compute Classic CLI in CLI Reference for Oracle Cloud Infrastructure Compute Classic.

To attach a storage volume to a running instance using the API, use the POST /storage/attachment/ method. For more information, see REST API for Oracle Cloud Infrastructure Compute Classic.

After attaching a storage volume to an instance, to access the block storage, you must mount the storage volume on your instance. See Mounting and Unmounting a Storage Volume.