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.
Enter the new size you want for the volume
and click on save changes.
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.
But before running this command, we will check the size of block volume
lsblk
and we also check the current size of the specific disk we want to increase
lsblk -ap /dev/sdb | head -2
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
But logical volume is still not increased
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.
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
Again run the partition command and check the size of part
sudo parted /dev/sdb print
Now size of the partition is increased
Run lsblk command and check size of disk and partition
lsblk
As we can see, the size has increased
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
next, we Resize the Physical Volume
pvresize /dev/sdb1
pvdisplay /dev/sdb1
Physical volume still display the old volume in allocated PE
we can check volume group allocated PE also
vgdisplay vg_u01
in below screen, we can see total PE,allocated PE and free PE
As we can see below, Logical volume is still not increased
Now, we Extend the Logical volume
lvextend -l +100%FREE /dev/mapper/vg_u01-lv_u01
Logical volume is increased now
But df –h still shows the old value
The last step is to resize the file system to extended 10 gb with right file format
resize2fs /dev/mapper/vg_u01-lv_u01
Finally, as shown in the screen below, running df -h confirms that the logical volume has been extended to the required size