Adding a Block Volume

Block Volume provides network storage to use with your Oracle Cloud Infrastructure instances. After you create, attach, and mount a volume to your instance, you can use it just as you would a physical hard drive on your computer. A volume can be attached to a single instance at a time, but you can detach it from one instance and attach to another instance, keeping your data intact.

This task shows you how to create a volume, attach it to an instance, and then connect the volume to the instance.

For complete details on Block Volume, see Overview of Block Volume Service.

Creating a Volume

  1. Open the navigation menu. Under Storage, click Block Volumes.

  2. Click Create Block Volume.
  3. In the Create Block Volume dialog, enter the following:
  4. Click Create Block Volume.

A 50.0 GB block volume is displayed in the provisioning state. When the volume is no longer in the provisioning state, you can attach it to your instance.

Attaching the Volume to an Instance

Next you attach the volume via an iSCSIA TCP/IP based standard used for communication between a volume and attached instance. network connection to your instance:

  1. Find your instance: Open the navigation menu. Under Compute, click Instances.

  2. Click your instance name to view its details.

  3. Click Attach Block Volume.
  4. In the dialog, enter the following:
  5. Click Attach.

The attachment process takes about a minute. You'll know the volume is ready when the Attachment State for the volume is ATTACHED.

Connecting to the Volume

Once your volume is attached, you can configure the iSCSI connection. You connect to the volume using the iscsiadm command-line tool. The commands you need to configure, authenticate, and log on are provided by the Console so you can easily cut and paste them into your instance session window. Once configured, you will be able to mount the volume on your instance and use it just as you would a physical hard drive.

To connect to your volume:

  1. Log on to your instance as described in Connecting to Your Instance.

  2. Open the navigation menu. Under Compute, click Instances.

  3. Click your instance name to view the attached storage volume.

  4. Click the Actions icon (This image displays the Actions icon from the Console) next to the volume you just attached and then click iSCSI Commands and Information.

    The iSCSI Commands and Information dialog is displayed. Notice that the dialog displays specific identifying information about your volume (such as IP address and port) as well as the iSCSI commands you'll need to use. The commands are ready to use with the appropriate information already included in each command.

  5. The Attach Commands configure the iSCSI connection and log on to iSCSI. Copy and paste each command from the Attach Commands list into the instance session window.

    Be sure to paste and run each command individually. There are three attach commands. Each command begins with sudo iscsiadm.

  6. After entering the final command to log on to iSCSI, you are ready to format (if needed) and mount the volume. To get a list of mountable iSCSI devices on the instance, run the following command:

    sudo fdisk -l

    If your disk attached successfully, you'll see it in the returned list as follows:

    Disk /dev/sdb: 274.9 GB, 274877906944 bytes, 536870912 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Connecting to Volumes on Linux Instances

    When connecting to volumes on Linux instances, if you want to automatically mount these volumes on instance boot, you need to use some specific options in the /etc/fstab file, or the instance may fail to launch. See /etc/fstab Options for the options to use in the /etc/fstab file.

What's Next

Now that you've got an instance running and attached some storage, consider the following next steps: