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 

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

 

2. Attach Volume to Compute Instance

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

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

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

 

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

b) Copy the iSCSI Connect Commands 

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

d) Create the Physical Volume (PV)

e) Create a Volume Group (VG)

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

g) Create xfs filesystem on the volume

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

i) Configure the LV to be automatically mounted on startup

run blkid command and copy the UUID of LV

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

j) verify the automatic mounting feature.

mount -a

and now run df -h

Reboot VM to make sure everything is set correctly.