In this blog, I will cover the steps to attach Block Volume to an existing LVM on an Oracle Cloud Infrastructure (OCI) Compute Instance.

Pre-requisites:

  1. OCI Tenancy Access
  2. OCI VCN
  3. OCI Compute Instance

 

Next Steps

1. Create a Block Volume

a) Go to Storage –> Block Volumes 

block2

b) Click Create Block Volume enter the volume name and other information and Click Create

block3

 

2. Attach Volume to Compute Instance

a) Once the volume is created, go to Compute Instance –> Resources –> Attach Block Volumes

block4

b) Click on attach Block Volume and select the volume created in Step1 and keep other info default, click attach.

block5

Now you will see the Block Volume attached to the Instance.

block6

 

3. Mount the Block volume to LVM on the Compute Instance

a) First click on 3 dots on the attached block volume –> iSCSI commands and information

block7

b) Copy the iSCSI Connect Commands 

block8

c) Login/SSH to the compute instance and run those iSCSI commands. After running the command run the lsblk to see the new partition.

block9

d) Create the Physical Volume (PV)

block10

e) Create a Volume Group (VG)

block11

f) Create Logical Volume using 100% space from the Volume Group

block12

g) Create xfs filesystem on the volume

block13

h) Create the mount point and mount the filesystem to that mount point.

mkdir /opt

mount <LV path> <Mount point>

In my case, the LV path is /dev/mapper/VolGroup01-LogVol00

mount /dev/mapper/VolGroup01-LogVol00 /opt

block14

i) Configure the LV to be automatically mounted on startup

run blkid command and copy the UUID of LV

block15

vi /etc/fstab and add this line if it’s not there. use the UUID from the above command

block16

j) verify the automatic mounting feature.

mount -a

and now run df -h

block17

Reboot VM to make sure everything is set correctly.