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. In the Console, click Storage, and then click Block Volumes.
  2. Click Create Block Volume.
  3. In the Create Block Volume dialog, enter the following:
  4. Click Create Block Volume.

A 256 GB block volume is displayed in the list 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: In the Console, click Compute, and then click Instances.

  2. Click your instance name to view its details.

  3. Click Attach Block Volume.
  4. In the dialog, enter the following:
    1. Block Volume Compartment: Select the compartment where you created the block volume.
    2. Block Volume: Select the block volume from the list.
    3. Require CHAP Credentials: Leave unselected.

      CHAPStands for Challenge-Handshake-Authentication-Protocol. It is a security protocol used by iSCSI for authentication between a volume and an instance. is a security protocol. You can leave this box unchecked for the purposes of the tutorial. When you set up your production environment, Oracle recommends requiring CHAP credentials.

  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. In the Console, click Compute, and then 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. Copy and paste each iscsiadm command from the iSCSI Information dialog into the instance session window.

    Notice that there are two sets of commands in the dialog, three commands in total. The commands configure the iSCSI connection and log on to iSCSI.

    Be sure to paste each command individually.

  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

    Important Note About Connecting with iSCSI on Linux Instances

    Block volumes on Oracle Cloud Infrastructure use iSCSI to connect to instances. On Linux instances, if you want to automatically mount these iSCSI volumes on instance boot, you need to use some specific options in the /etc/fstab file, or the instance may fail to launch. This can occur because the operating system tries to mount the volume before the iSCSI initiator has started. 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: