Thursday, November 22, 2018
Home > Linux / Unix > LVM in Linux with Examples

LVM in Linux with Examples

LVM in Linux with Example

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 Features

  • 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.

pvs PVS

vgsvgs

 lvslvs

pvdisplaypvdisplay

dvdisplayvgdisplay

In above snap we have some important information which is summarized below. 

  1. VG Name – Volume Group name.
  2. Format – LVM Architecture Used LVM2.
  3. VG Access – Volume Group is in Read and Write and ready to use.
  4. VG Status – Volume Group can be re-sized, We can Expand per our need if we need to add some more space.
  5. Cur LV – Currently there was 3 Logical volumes in Volume Group.
  6. CurPV and Act PV – Currently Using Physical Disk was 3 (vda), And its active, so what we can use this volume group.
  7. 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.

  1. Total PE – This Volume Group we have.
  2. Alloc PE – Total PE Used, full PE already Used.
  3. Free PE – Here it is already used so there was no free PE.

lvdisplaylvdisplay

Admin
We are group of application developer and admin.We are providing good content of information about IT technology and services .

Leave a Reply

Your email address will not be published. Required fields are marked *