miércoles, 31 de octubre de 2018

How to resize a Block Volume in Oracle Cloud Infrastructure (OCI)


In this example, I have an Instance in OCI called "LinuxInstance1". The instance has a Block Volume already attached "BlockVolume1". The Block Volume has 256G as can see in the following image:


The first step we have to do before to resize a Block Volume is checking out if the Block Volume is mounted.  In this example, the Block Volume is indeed mounted in the filesystem "/mnt/filesystem1":


In that filesystem, I have a txt file called "file1.txt" with the text "Deiby Gomez":


Now that we confirmed that the Block Volume is being used because it is mounted, we will proceed to unmount it:


Now, let's go to the Instances section in Oracle Cloud Infrastructure (OCI). Click in the upper left corner menu and then "Compute -> Instances":


All the instances will be listed, Click in the instance that has attached the Block Volume we want to resize, in this example it's "LinuxInstance1"


In the section "Attached Block Volumes" Click in the Block Volume you want to resize:


Click in the button "Detach from Instance":


You will see the commands you have to execute in a terminal to detach the iSCI volumes, copy these commands:



Paste the commands into a terminal that is connected to the Instance via SSH:


Once the commands were executed, click in the Button "Continue Detachment" in OCI:


You will see a message saying that we must run the iSCI commands first. Click in "Ok" since it was already done:


Once the Block Volume was detached, the button "Resize" is enabled as you can see in the following image:


Finally, the size can be changed:


During the Block Volume is being resized, you will see the Block Volume in status "Provisioning":


After some minutes, you will see the Block Volume in status "Available":


So far, the Block Volume is already resized. The next step is re-attach the Block Volume to the Instance. To do so, click in the upper left corner menu and then "Compute -> Instances":


Click in the Instance we want to attach the Block Volume to:


Click in the section "Attached Block Volumes" and then Click in the button "Attach Block Volume":


Specify the Compartment and the Block Volume you want to attach:


A message will be displayed saying that once the Block Volume is attached, the iSCI commands must to be executed in a terminal with a session to the Instance via SSH:


While the Block Volume is being attached, it will be in "Attaching" Status:


Once it is attached, it will be in "Attached" status:


Click in "iSCSI Commands & Information":


The iSCSI commands to attach the volume will be listed, copy all the "ATTACH COMMANDS":


Execute the commands in a Terminal with a session to the Instance via SSH:


The Disk will be listed with the proper size (1T) however the filesystem has to be resized:


Now the filesystem will be resized, and the file "file1.txt" will be displayed:



IMPORTANT NOTE:

OCI has a problem resizing Block Volumes larger than 512G. This is explained in the following link https://docs.cloud.oracle.com/iaas/Content/knownissues.htm


If you try to resize a Block Volume larger than 512 G you will see the following error:






How to attach a new Block Volume to an Instance in Oracle Cloud Infrastructure (OCI)

We will start from the "Dashboard Page":




Click in the menu in the upper left corner and then click in "Block Storage -> Block Volumes":



Select the right Compartment and then Click in the button "Create Block Volume":


Fill up all the information required and then click in the button "Create Block Volume":


I am using "Backup Policy" Bronze. The available values are:


If you don't know what each option means, you can read the following:

Source: https://docs.cloud.oracle.com/iaas/Content/Block/Tasks/schedulingvolumebackups.htm

The Block Volume will be listed in status "Provisioning":


After some minutes, the Block Volume will be listed in status "Available":


Once the Block Volume was created, the next step is to attach it to an Instance. To do so, click in the menu in the upper left corner and then "Compute -> Instances":


All the instances will be listed, click in the Instance you want to attach the Block Volume to:


Click in the section "Attached Block Volumes" and then Click in the button "Attach Block Volume":


Select "iSCSI", the Compartment where the Block Volume is stored and the Block Volume name that you want to attach. Select the permissions you want for this Block Volume:


A message will be displayed, just click in "Close":


The Block Volume will be listed in the section "Attached Block Volumes", if you want to see further information about this Block Volume click in "View Block Volume Details":


You will se something like the following:


Next step is to run the "iSCSI attach commands" at the OS level, to do so click in "iSCSI Commands & Information":


You will see the commands to attach and to detach.


Copy "attach command" (each of the three lines) and past them one by one in a terminal connected via SSH to your Instance.




You should see now the Block Volume already registered in the OS:


Next step is to format the Disk and also to mount it:


Oracle ACE Director Award - Deiby Gómez

Thanks #OracleACE Program for this awesome certificate recognizing the work I have done in the community for the last year. Looking forwa...