12. Resizing Block Volumes - Ayushi-srivastav/OCI GitHub Wiki

Steps to Resize Block Volumes

Initially, we will resize the block volume in OCI

Step 1 : Increase size in console

Select the Edit option on the Block Volume page.

image

Enter the new size you want for the volume

and click on save changes.

image

Step 2 : Increase Disk Size

"Next, we will receive a rescan commands that needs to be run in PuTTY to increase the size of the block volume.

image

But before running this command, we will check the size of block volume

lsblk

image

and we also check the current size of the specific disk we want to increase

lsblk -ap /dev/sdb | head -2

image

Now, Edit the copied rescan command according to the current requirement (i.e., which disk we want to upgrade)

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

and then run lsblk command to check disk size is increased or not

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

here we can see disk size is increased

image

But logical volume is still not increased

image

Step 3 : Verify whether the partition exists

sudo parted /dev/sdb print

In the screen below, we can see that the size of the partition remains the same as before.

image

Step 4 : Increase the partition to new size

Now grow the partition

sudo growpart /dev/sdb 1

below we can see old and new size of partition

image

Again run the partition command and check the size of part

sudo parted /dev/sdb print

Now size of the partition is increased

image

Run lsblk command and check size of disk and partition

lsblk

As we can see, the size has increased

image

Now, 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

The logical volume is still the same as before; it has not increased yet

image

next, we Resize the Physical Volume

pvresize /dev/sdb1
pvdisplay /dev/sdb1

Physical volume still display the old volume in allocated PE

image

we can check volume group allocated PE also

vgdisplay vg_u01

in below screen, we can see total PE,allocated PE and free PE

image

As we can see below, Logical volume is still not increased

image

image

Now, we Extend the Logical volume

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

image

Logical volume is increased now

image

But df –h still shows the old value

image

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

Finally, as shown in the screen below, running df -h confirms that the logical volume has been extended to the required size

image