Logical Volume Management (LVM) in Linux makes to understand, how to manage disk space. If any file system (FS) needs some more space, then we will add to its logical volumes(LV) from the free spaces in its volume groups(VG) and the file system will be re-sized as per our need.
If any disk is not able to start, then replacement disk can be registered as a physical volume with the volume group and the logical volumes extents can be migrated to the new disk without data loss.
- LVM is flexible to expand the space.
- Any file systems can be installed and handle easily.
- Migration can be used to recover faulty disk at any time.
- Restore the file system using Snapshot is one of the important.
Creating LVM Disk Storage in Linux
We have used Redhat Operating system using LVM in a Virtual Disk.
Here we see the Physical Volumes(PV), Volume Groups(VG) and Logical Volumes(LV) by using the below commands.
In above snap we have some important information which is summarized below.
- VG Name – Volume Group name.
- Format – LVM Architecture Used LVM2.
- VG Access – Volume Group is in Read and Write and ready to use.
- VG Status – Volume Group can be re-sized, We can Expand per our need if we need to add some more space.
- Cur LV – Currently there was 3 Logical volumes in Volume Group.
- CurPV and Act PV – Currently Using Physical Disk was 3 (vda), And its active, so what we can use this volume group.
- PE Size – Physical Extends, Size for a disk will be defined by using PE or GB size, 4MB is the Default PE size of LVM. For example, if we need to create 5 GB size of logical volume we can use sum of 1280 PE.Refer below example.
Here is Explanation –> 1024MB = 1GB, hence if you need 5GB=1024MB x 5 = 5120PE = 5GB, Now Divide the 5120/4 = 1280, 4MB is the Default PE Size.
- Total PE – This Volume Group we have.
- Alloc PE – Total PE Used, full PE already Used.
- Free PE – Here it is already used so there was no free PE.