We have an Oracle Linux Virtual Machine that we created in our previous post https://ahmedfattah.com/2019/12/10/oracle-virtualbox-create-new-virtual-machine/ up and running.
When I examined the space on this VM, I found that I have only 2GB of free space available in “/” filesystem, which is not enough for me to do my work.

So, I decided to increase the space by another 10GB.
How many physicals disks that we have, how many partitions?. Let us see:

So, we have one physical disk (/dev/sda) divided into 2 partitions, /dev/sda1 for /boot (small one) and larger partition /dev/sda2) , that is used to build LVM.
We have to Logical Volums (2 lvs) ,, one for swap (3GB) , and the larger one for “/” file system.
Given this disk layout, we have two options to increase the “/” filesystem size:
1- To add a new physical disk to the VM, and use it to expand the LV and so the filesystem.
2- To resize the current physical disk from about 39GB to 50 GB, and then resize the LV and filesystem.
I’ll proceed with the second option.
Stop the VM

Now start the VM, and check the free space:


Now, we will use the newly added space to create a new disk partition, using the fdisk command:

Now examine the disk layout again:

Now, we are going to create physical volume on the new partition (but we need to reboot the VM first):


What about the volume group?:

Now we are going to extend the volume group with the newly added PV (/dev/sda3):

So, now the volume group is about 50GB, 10GB of them are free:

What about the logical volums?:

Extend the LV (lv_root) by 10GB:

Now is the last step, which is to extend the filesystem created above the logical volume lv_root:

Now, check the free space again:

That’s all.

Donate to support our blogging work
$1.00
Thanks
Ahmed