How to attach block volume in OCI instance

We often require to add additional block volume in OCI instance for different requirements. In this post I will show how to do this.


Step 1. First Login to OCI console

Step 2. Navigate to Block Storage à Block Volumes à Create Block Volume






Step 3. Fill in the required information such as 
  • Compartment name – Choose the compartment where your oci instance belongs to
  • Name – Provide a name for the volume
  • Volume size and performance- Here we have two options such as Default and Custom. By choosing default option oci would create a volume of size 1 tb .If we go for custom ,we can provide our desire size for the volume. Minimum size of a custom volume is 50GB. You can also choose the performance type for the volume as well.
  • Backup Policy- If you wish to choose a backup policy for the volume, we can select one here as per your requirement.
  • Encryption- For encryption it I choose the option "Encrypt using oracle managed keys".




Step 4. Once volume creation is done, navigate to compute instances tab and select the instance where you would like to add the volume




Under resources, click on “attached block volumes” option




Step 5. In the attach block volume window, choose volume attachment type as “iSCSI”. Also choose the block volume from block volume drop down menu. Provide a device path (optional).Provide desired Access type for the block volume.




Once attachment is done, the following message appears.




Step 6. Now on the same page , click on 3 dots on right bottom corner and click on iSCSI Commands and information. This would pop up a window with a few commands that would be used to attach the block volume with the compute instance.

Run the below commands in any ssh terminal of the compute instance to attach the block volume.

For detaching the block volume commands are also provided.




Run the below commands in any ssh terminal of the compute instance to attach the block volume.

For detaching the block volume commands are also provided.



Run the below commands from ssh terminal of the compute instance to attach the block volume.

For detaching the block volume commands are also provided in above screenshot.


So we can see from lsblk command that a 50GB volume is showing.

Step 7.  Now format the newly added volume and mount it . Commands are shown in the below screenshot. We have mounted the volume /dev/oracleoci/oraclevdb volume as /u01 mount point.



Step 8 .Add entry in /etc/fstab file 

/dev/oracleoci/oraclevdb /u01 ext4 defaults,noatime,_netdev 0 2


So this includes the activity of adding additional block volumes in OCI instance.

1 comment: