Lab:12 Create Block volume with Backup - TanveeKhanDB/OCI GitHub Wiki
1) What is Block Volume?
OCI Block Volume is network-based storage for compute instances. It works like an extra hard disk attached to a VM/Bare Metal server.
In simple workd we can say Block Storage in Oracle Cloud Infrastructure (OCI) is persistent storage for your compute instances. A Block Volume is like a virtual hard drive that you can attach to instances and store data. Backups protect your data by creating copies.
Simple 3-Step Process:
You can: Create volume Attach / detach Move to another server Resize Change performance Data stays safe even if instance is stopped or deleted. 👉 Simple: Block Volume = detachable cloud hard disk
Main Components
To use Block Volume, you need:
a) Instance
A VM or Bare Metal server in OCI
This is where volume gets attached
b) Volume
Two types:
Block Volume → extra storage disk
Boot Volume → OS disk used to boot server
c) Volume Attachment How volume connects to server:
iSCSI → network-based connection
Paravirtualized → VM optimized virtual connection
3) Why Use Block Volume?
Block Volume is mainly used for:
Add extra storage to server
Store application / DB data
Keep data safe even after instance termination
Move storage between servers
Improve performance
Scale server storage anytime
👉 Simple: Use Block Volume when server needs flexible extra storage
4) Common Real Scenarios
Scenario A: Expand Storage
👉 Like adding a new hard drive to laptop
Scenario B: Persistent Storage
👉 Like unplugging hard disk from one PC and using in another
Scenario C: Instance Scaling
👉 Same OS + same data, bigger machine
5) Volume Attachment Types
a) iSCSI
Uses TCP/IP network
Manual setup required
Better IOPS / performance
Best for high-performance workloads
Used for: Bare Metal
Older Linux / Windows images
Not work with windos OS
👉 Best performance, more setup
b) Paravirtualized
Easier and faster
No manual iSCSI commands
Ready after attach
Lower IOPS than iSCSI
Used for:Modern VM instances
Only work with Oracle Linux
👉 Easy to use, slightly lower performance
8) Region & Availability Domain Rules
Volume works only in same Availability Domain (AD)
Cannot directly move volume to another AD / Region
To move:
Take backup
Restore in new AD / Region
👉 Volume is local, backup is portable
Flow dig of how to create Block volume in OCI
Steps to create Block volume with backup in OCI
OCI provide option to switch your BV to another compartment hence I have moved it to Hub_storage_and_compute_comarptment
Run below command to verify existing volume in server
lsblk
Attaching instance wiht Block Volume:
Copy and paste attached command in linux CUI to create new volume
Formating the disk
To Create and see the Physical Volume:
pvcreate /dev/sdb1
pvdisplay /dev/sd1
To create and see the Volume Group:
vgcreate vg_u01 /dev/sdb1
vgdisplay vg_u01
Create logical volume and map it to our VG:
lvcreate -l 25599 -n lv_u01 vg_u01
ls -l /dev/mapper/vg_u01-lv_u01
Formatting the logical Volume:
mkfs.ext4 /dev/mapper/vg_u01-lv_u01
Creating directory
mkdir /u01
Mounting the logical volume using ext4 file system
mount -t ext4 /dev/mapper/vg_u01-lv_u01 /u01
Mount volume permanently
We will mount this volume permanantly in /etc/fstab or else after server reboot this volume will be removed.
vi /etc/fstab
add in last line of fstab file used to mount is permantly to linux OS hence after reboot it will be there.
/dev/mapper/vg_u01-lv_u01 /u01 ext4 defaults,_netdev,nofail 0 2
Mounted sucessfully: