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.
- In the Console, click Storage, and then click Block Volumes.
- Click Create Block Volume.
- In the Create Block Volume dialog, enter the following:
- Create in Compartment: This field defaults to your current compartment. Select the compartment you want to create the volume in, if not already selected.
- Name: Enter a user-friendly name.
- availability domain: Select the same availability domainOne or more isolated, fault-tolerant Oracle data centers that host cloud resources such as instances, volumes, and subnets. A region contains several availability domains. that you selected for your instance. If you followed the tutorial instructions when launching your instance, this will be the first AD in the list. The volume and the instance must be in the same availability domain.
- Size: Select 256.0GB.
- 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.
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:
Find your instance: In the Console, click Compute, and then click Instances.
Click your instance name to view its details.
- Click Attach Block Volume.
- In the dialog, enter the following:
- Block Volume Compartment: Select the compartment where you created the block volume.
- Block Volume: Select the block volume from the list.
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.
- Click Attach.
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:
Log on to your instance as described in Connecting to Your Instance.
- In the Console, click Compute, and then click Instances.
Click your instance name to view the attached storage volume.
Click the Actions icon () 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.
Copy and paste each
iscsiadmcommand 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.
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/fstabfile, 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
Now that you've got an instance running and attached some storage, consider the following next steps: