Previously we have seen how to create a flexible disk storage using LVM. Here, we are going to see how to extend volume group, extend and reduce a logical volume. When do we need to reduce volume? May be we need reduce pdf file size linux create a separate partition for any other use or we need to expand the size of any low space partition, if so we can reduce the large size partition and we can expand the low space partition very easily by the following simple easy steps.
Currently, we have One PV, VG and 2 LV. Let’s list them one by one using following commands. There are no free space available in Physical Volume and Volume group. We will get enough space to extend the Logical volume size. So first we are going to add one physical volume. Choose which number of partition to be selected to create the primary partition.
Restart the system once completed. List and check the partition we have created using fdisk. Verify the pv using below command. Let us check the size of a Volume Group now using. Here, we can see which Volume groups are under Which Physical Volumes. We have just added one pv and its totally free.
Let us see the size of each logical volume we have currently before expanding it. After expanding we can list out the size as above for confirmation. We can extend using GB or PE as I have explained it in LVM PART-I, here I’m using PE to extend. For getting the available Physical Extend size run. Let us use the PE size to extend. After Extending, we need to re-size the file-system using.
Command used to extend the logical volume using Physical extends. Here we can see it is extended to 34GB from 16. Re-size the file system, If the file-system is mounted and currently under use. For extending Logical volumes we don’t need to unmount the file-system.
Now let’s see the size of re-sized logical volume using. After extending there is 34. Current extends, Before extending there was 4226, we have added 4607 extends to expand so totally there are 8833. Now if we check the vg available Free PE it will be 0. See the result of extending.
Volume group vg_tecmint extended from 17. Here we have completed the process of extending volume group and logical volumes. Let us move towards some interesting part in Logical volume management. Here we are going to see how to reduce the Logical Volumes. Everyone say its critical and may end up with disaster while we reduce the lvm. Reducing lvm is really interesting than any other part in Logical volume management. Before starting, it is always good to backup the data, so that it will not be a headache if something goes wrong.