Skip to content

Lab 13 ‐ Create Block volume with Backup

Md Mahbub Alam edited this page Oct 25, 2026 · 7 revisions

Block Volume in OCI

In OCI, a Block Volume is a high-performance, network-attached storage service that works like a virtual hard drive. It stores data persistently, even if the compute instance becomes inaccessible, and can be attached to another instance to access the data.

  • Storage capacity: 50 GB to 32 TB per volume.
  • Attachment: Up to 32 block volumes per instance.
  • Mount Point: In Linux, a directory where the block volume is mounted to access and manage its data.

Creating Block Volume

Navigation menu > Storage > Block Volumes

image
  • Click on create block volume and select the name of block volume
image
  • Select the compartment
image
  • Select the same AD which is available in instancs
image
  • Select the custom volume size which has range 50 GB to 32TB and based on the volume size performance will varries
image
  • Target Volume Performance: Measured in VPU (Volume Performance Units). Select a performance level from the VPU Type dropdown or enable Performance-Based Auto-Tune to automatically adjust performance between the default and maximum VPU levels.
image
  • In the Backup Policies section, select the compartment and then choose a backup policy. Generally, Gold provides more frequent backups, while Bronze is suitable for testing and less critical data. Choose a policy based on your data protection needs.
image
  1. Gold : Take daily backup, Daily incremental backups at midnight. Retain 7 days. Weekly incremental backups. at midnight sunday. Retain 4 weeks. Monthly incremental backups. at midnight on the 1st of the month. Retain 12 months. Yearly incremental backups. During first part of january. Retain 5 years.
image
  1. Silver : Weekly incremental backups. at midnight sunday. Retain 4 weeks. Monthly incremental backups. at midnight on the 1st of the month. Retain 12 months. Yearly incremental backups. During first part of january. Retain 5 years.
image
  1. Bronze : Monthly incremental backups. at midnight on the 1st of the month. Retain 12 months. Yearly incremental backups. During first part of january. Retain 5 year
image
  • In the Cross-AD/Region Replication section, enable replication and select the target region, AD, replica name, and encryption settings. You need a compute instance in the target region/AD to access the replica. Replication helps with disaster recovery, migration, and business expansion. Cross-region replication requires access to the target region.
image image
  • In the Volume Encryption section, we generally choose Encrypt using Oracle-managed keys. However, we can select Encrypt using customer-managed keys if required by the client.
image
  • Then Click on Create Block Volume
image

Attach Block Volume to an Instance in OCI

Navigation menu > Storage > Block volumes

image
  1. Click on block volume
image
  1. On new page click on Attached instances
image
  1. Select Attachment type
  • iSCSI: Requires manual setup but offers high performance. Supports Bare Metal and Virtual Machines.
  • Paravirtualized: Easy to set up and offers good performance. Supports Virtual Machines only.
image
  1. Select Select Access type
image
  1. Select instance
image
  1. Click Attach and run the provided iSCSI commands on your instance to connect the block volume.
image image

Attach Block Volume to an Instance via PuTTY

  • Open PuTTY and run the lsblk command to view all available storage devices attached to the server sda indicate that it is a disk inside which there are three partitions sda1, sda2, and sda3
image
  • To attach or detach a volume, run the iSCSI commands in PuTTY. To view these commands, go to Attached Instances, click the three-dot menu next to your instance, and select iSCSI IPv4 Commands & Information.
image image image
  • To attach a new block volume to an instance copy iSCSI attach command and paste into terminal and hit enter
image
  • Verify attachment using lsblk command and also run df -h to check if it's mounted and you will see it's not mounted
image image image
  1. For create new partition sudo -su root

fdisk /dev/sdb

image image
  • Type n and press Enter to create a new partition. Press Enter to accept all default values. Once you see the message Created a new partition, type w and press Enter to save the changes.
image image
  1. Create a Physical Volume (PV)
  • Create PV using pvcreate /dev/sdb1

pvcreate /dev/sdb1

image
  • Verify using pvdisplay /dev/sdb1

pvdisplay /dev/sdb1

image
  1. Create a Volume Group (VG)
  • Create VG using vgcreate vg_01 /dev/sdb1

vgcreate vg_01 /dev/sdb1

image
  • Verify VG creation using vgdisplay vg_01 which also display number of Physical Extent (PE)

vgdisplay vg_01

image
  1. Create a Logical Volume (LV) and map it to our Volume Group (VG)

lvcreate -l 12799 -n lv_01 vg_01

  • -l 12799: Specifies the size of the logical volume in Logical Extents (LE)
  • -n lv_01: The name flag
image
  • Here the number 12799 represent the number of Physical Extent (PE) in vg_01. Each extent is typically 4MB, so this coluld create a LV of approximately 49.99GB (12799 extents * 4MB per extent).
  • To check the size of created LV run lsblk
image
  • ls -l /dev/mapper/vg_01-lv_01
image
  • Logical volume is created inside our volume group.
  1. Format this LV using a file system

mkfs.ext4 /dev/mapper/vg_01-lv_01

image
  1. Create a directory and mount the ext4 file system LV

mkdir /u01 lsblk

image
  • mount -t ext4 /dev/mapper/vg_u01-lv_u01 /u01 df -h
image

Here we can see the LV is mounted at newly created mount point /01

Mounting Block Volumes Permanently

It is important to permanently mount a volume in /etc/fstab or else after server reebot the temporarily mounted volume will be unmounted

vi /etc/fstab

image
  • Here add /dev/mapper/vg_01-lv_01 /01 ext4 defaults,_netdev,nofail 0 2 after the last line of fstab file and to write & quit type :wq /dev/mapper/vg_u01-lv_01 /01 ext4 defaults,_netdev,nofail 0 2 :wq

  • Use mount -a command (or mount --all) to mount all filesystems defined in the system's filesystem table (/etc/fstab) that are not already mounted. To verify reboot the server and use df -h command and see if the BV is automatically mounted or not.

image

Clone this wiki locally