16_Resizing_Block_Volumes - Nirvan-Pandey/OCI_DOC GitHub Wiki

Steps to Resize Block Volumes

16_1: Increase the size in OCI console.

Step1: Initially, we will resize the block volume in OCI. Please note the current size is 50 GB.

Step2: Select the Edit option on the Block Volume page.

image

Step3: Enter the desired new size of the volume and save changes.

image

16_2: Increase the disk size.

Step1: After saving the changes, we get the "Resize Block Volume" box containing the volume rescan commands, as shown below.

These commands need to be copied and run in the Linux server(via Putty) to increase the size of the block volume.

image

Step2: Before executing this command, check the size by lsblk.

lsblk

image

Step3: We also need to check the current size of the specific disk, which we want to increase.

lsblk -ap /dev/sdb | head -2

image

Step4: Execute the volume recan commands.

Please be careful while executing this command.

We need to Edit the copied rescan commands according to the actual disk name in the Linux we want to upgrade.

Copied rescan commands

sudo dd iflag=direct if=/dev/oracleoci/oraclevd<paste device suffix here> of=/dev/null count=1
echo "1" | sudo tee /sys/class/block/`readlink /dev/oracleoci/oraclevd<paste device suffix here> | cut -d'/' -f 2`/device/rescan

Edited recan commands

sudo dd iflag=direct if=/dev/sdb of=/dev/null count=1
echo "1" | sudo tee /sys/class/block/sdb/device/rescan

Step5: Check the size.

lsblk
lsblk -ap /dev/sdb | head -2

image

We can see that the disk size is increased. However, logical volume & partition size is still not increased.

Step6: Verify whether the partition exists.

Run the command "sudo parted /dev/sdb print" to check the Disk and the partition size.

sudo parted /dev/sdb print

In the output shown below, we can see that the disk size has increased, but the partition size remains the same as before.

image

16_3: Grow the partition to new size.

Step1: Now grow the partition.

sudo growpart /dev/sdb 1

Step2: We are able to see both the old and new size of partition.

image

Step3: Again run the partition command and check the size of part. The size of the partition is now increased.

Now size of the partition is increased.

sudo parted /dev/sdb print

image

Step4: Run lsblk command and check size of disk and partition.

The size has been increased but the logical volume is the same as before.

lsblk

image

Step5: Run the command to display detailed information about a specific logical volume (lv_u01) in a volume group (vg_u01).

lvdisplay -am /dev/mapper/vg_u01-lv_u01

image

16_4: Resize the Physical Volume.

Step1: Display the physical volume.

pvresize /dev/sdb1
pvdisplay /dev/sdb1

image

Physical volume still display the old volume in allocated PE.

Step2: We can check volume group allocated PE also.

vgdisplay vg_u01

image

Step3: Display the volume size.

Logical volume size is still not increased.

df -h
lsblk

image

Step4: Extend the Logical volume size.

To increase the Logical volume size, we need to Extend the Logical volume size using the command below.

lvextend -l +100%FREE /dev/mapper/vg_u01-lv_u01

image

Step5: Logical volume is increased now. However "df -h" still shows the old value.

image

Step6: Resize the file system.

The last step is to resize the file system to extended 10 gb with right file format.

resize2fs /dev/mapper/vg_u01-lv_u01

image

Step7: Verify the disk.

lsblk
df -h

image