LAB 12 (Create Block Volume with Backup) - arunsinghchauhan38-arch/CLOUDARCHITECTDOC GitHub Wiki

Block Volume with Backup

In Oracle Cloud Infrastructure (OCI), a Block Volume is a managed, high‑performance, network‑attached storage device that you can provision, attach to compute instances, and use like a physical hard drive. It provides persistent, durable, and scalable storage for workloads such as databases, enterprise applications, and virtual machines.

Key Characteristics of OCI Block Volume

  • Persistent Storage: Data remains intact even if the compute instance is stopped or terminated.

  • Detachable & Portable: Volumes can be detached from one instance and reattached to another without data loss.

  • Scalable Capacity: Ranges from 50 GB to 32 TB, expandable online without downtime.

  • High Performance: Supports up to 480,000 IOPS for demanding workloads. Performance is tuned using Volume Performance Units (VPUs).

  • Durability & Availability: Data is automatically replicated across multiple fault domains within an availability domain.

  • Encryption by Default: Integrated with OCI Vault for customer-managed keys.

  • Backup & Cloning: Snapshots stored in Object Storage; cloning enables fast duplication of volumes.

Types of Volumes in OCI

  1. Block Volume: General-purpose storage for application data, databases, and workloads.

  2. Boot Volume: Contains the operating system image used to boot a compute instance.

Steps to Create Block Volume

Step 1

Goto Burger Menu then click on Storage and now click on Block Volumes

Step 2

Select Compartment - Hub_compute_and_storage_compartment and click on Create Block Volume Button

Step 3

Fill Details and select compartment where we create our block volume-Hub_compute_and_storage_compartment and select avaiblility domin (AD-1)

Step 4

Now in Volume size and performance we select Custom tab because we choose Volume Size as per our application requirement. Here we create 50 GB Volume size.

Note :- In Block Volume, volume size chargeable when we create it. so choose volume size very carefully when we create block volume.

Step 5

In Backup policies we first select our backup policy compartment as hub_compute_and_storage_compartment and in Select Backup Policy we select Gold

Step 6

Now we attached instances with our created block volume

Goto Bastion-Block Volume, inside it click on Attached instances

Now Click on Attached instance

Now we Select Attachement type iSCSI this storage protocol work with the multipal operatiog systems like Window,linux,redhat etc.

Next we select Access Type : Read/Write

Next, now select instance , after this click on attach

Now we attach block volume by use of putty application

First login into the putty applicaiton and run command

lsblk

Attach Block Volume

to attach block volume we go to the created block volume and click on avaialbe ... 3 dot and click on iSCSI /Pv4 Commands & Information and copy all 3 command and paste into the putty

Now we can run the command df-h to check if this volume is showing or not

df -h

Its is still not showing, so now we have to mount this volume to be ready for the use.

To Create a new partition and format the disk, we run the command fdisk /dev/sdb and type m for help

fdisk /dev/sdb

Now press N to create new partition, select the default options, and type w to save the changes

Now we Create physical volume, to create it run the command

pvcreate /dev/sdb1

after this command to display the created physical volume use command

pvdisplay /dev/sdb1

Now we create a Volume Group for this run command

vgcreate vg_u01 /dev/sdb1

After this to display the created Volume group

vgdisplay vg_u01

Here Number 12799 represents the extent size in the volume group vg_u01. Each extent equal to 4MB. so this would create a logical volume of approximately 51.2GB (12799 extents* 4MB per extents)

Next we create logical volume and map it to our volume group. Use command to create logical volume is

lvcreate -l 12799 -n lv_u01 vg_u01

To check, logical volume is created inside our volume group run the command

ls -l /dev/mapper/vg_u01-lv_u01

Now Run the command to format the logical volume using a file system

mkfs.ext4 /dev/mapper/vg_u01-lv_u01

Now we create a Directory and mount the logical volume mkdir/u01 and mount ext4 file system

mkdir /u01
mount -t ext4 /dev/mapper/vg_u01-lv_u01 /u01

final step is to mount volume permanently. for mounting we run the command vi/etc/fstab or else after server reboot this volume will be removed.

vi /etc/fstab

The fstab file now open in vi editor now we need to add a command into the last line of the editor /dev/mapper/vg_u01-lv_u01 /u01 ext4 defaults,_netdev,nofail 0 2 and save the file.

for write in vi editor we use press Esc key + i + press Enter key

To save (:wq!) press Esc key + : + wq + ! + press Enter key

/dev/mapper/vg_u01-lv_u01 /u01 ext4 defaults,_netdev,nofail 0 2

Now run the mount -a command, if no error after the command so it means our volume mounted successfully. after this run command df -h

mount -a
df -h

After done everything we need to reboot the instance server.

To Reboot the Instance : Go to Instance - Bastion-server-actions -click on Reboot - Click on check box force reboot and finally click on reboot.