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.
Open the navigation menu. Under Storage, 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: Enter 50 to create a 50GB block volume.
- Backup Policy: Select None.
- Tags: Leave tagging fields blank.
- 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.
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: Open the navigation menu. Under Compute, click Instances.
Click your instance name to view its details.
- Click Attach Block Volume.
- In the dialog, enter the following:
- Select ISCSI.
- 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.
- Access: Select Read/Write.
- 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.
Open the navigation menu. Under Compute, 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.
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
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/fstabfile, or the instance may fail to launch. 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: