Repository navigation
Lab 13 ‐ Create Block volume with Backup
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.
Navigation menu > Storage > Block Volumes
- Click on create block volume and select the name of block volume
- Select the compartment
- Select the same AD which is available in instancs
- Select the custom volume size which has range 50 GB to 32TB and based on the volume size performance will varries
- 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.
- 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.
- 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.
- 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.
- 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
- 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.
- 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.
- Then Click on Create Block Volume
Navigation menu > Storage > Block volumes
- Click on block volume
- On new page click on Attached instances
- 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.
- Select Select Access type
- Select instance
- Click Attach and run the provided iSCSI commands on your instance to connect the block volume.
- 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
- 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.
- To attach a new block volume to an instance copy iSCSI attach command and paste into terminal and hit enter
- Verify attachment using lsblk command and also run df -h to check if it's mounted and you will see it's not mounted
- For create new partition sudo -su root
fdisk /dev/sdb
- 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.
- Create a Physical Volume (PV)
- Create PV using pvcreate /dev/sdb1
pvcreate /dev/sdb1
- Verify using pvdisplay /dev/sdb1
pvdisplay /dev/sdb1
- Create a Volume Group (VG)
- Create VG using vgcreate vg_01 /dev/sdb1
vgcreate vg_01 /dev/sdb1
- Verify VG creation using vgdisplay vg_01 which also display number of Physical Extent (PE)
vgdisplay vg_01
- 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
- 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
- ls -l /dev/mapper/vg_01-lv_01
- Logical volume is created inside our volume group.
- Format this LV using a file system
mkfs.ext4 /dev/mapper/vg_01-lv_01
- Create a directory and mount the ext4 file system LV
mkdir /u01 lsblk
- mount -t ext4 /dev/mapper/vg_u01-lv_u01 /u01 df -h
Here we can see the LV is mounted at newly created mount point /01
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
-
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.