Logical Volume Management (LVM on CentOS)

Generally, the disk has multiple partitions because it provides separation between data types but it does not offer flexibility. It is not possible to dynamically grow partitions when running out of space.

LVM provides greater flexibility. You can extend and resize volumes. LVM has several layers where lower layer consists of any storages devices like Complete Disk, Partitions and LUNs on SAN. There are few steps in LVM management which are –

  • Creating Physical Volumes
  • Creating Volume Groups
  • Creating Logical Volumes

LVM Architecture


We flag the physical volumes to make them usable by LVM. You have already known to create partitions on a disk if no idea then see my previous post Managing Disk Storage Using Fdisk

If you are using MBR disk then make sure that you partition have filesystem flag to 8e for the LVM. If you are using a GUID disk, use the partition type 8300.

For Example, add 3 physical disks in your machine or you can create VHDs in virtual machine on VMWare Workstation or Oracle Virtualbox and create one partition on each disk with filesystem id Linux LVM.

Suppose our newly disk names are /dev/sdb, /dev/sdc, /dev/sdd and partitions are /dev/sdb1, /dev/sdc1 and /dev/sdd1

use pvcreate command to create physical disks.


Use pvdisplay command for the more details or you can use pvs command for the summary.

if you want a very synthetic view of configured storage then use lsblk command


A storage device that is a physical volume can be added to the volume group, which is an abstraction of all available storage. It is not fixed, it can be resized when it is required by adding more physical volumes. To create volume group use vgcreate command followed by volume group name and physical volumes create previous steps. You are free to choose volume group name but it will be better to use proper nomenclature to easily recognize volume groups. You can use VG- as the prefix for volume groups.

When creating the volume group, physical extent size is used, defines the building blocks used to create logical volumes. A Logical Volume always has a size that is multiple of physical extent size. If you want to create huge volume then it is more efficient to use big physical extent size. If you do not specify anything then by default extent size is 4 MiB .



Great, now you can start to create the logical volumes.  While creating logical volumes, you have to give logical volume name and size. The volume size can be specified by -L options and name by -n option.

For example, you can use -L 5G to create volume with 5GB. Alternatively, you can use relative sizes using -l option. For instance use, -l 50%FREE to use half of available disk space.  Logical volumes naming scheme is /dev/VG-STORAGE/lvname



use vgextend command is used to add more storage in the volume group. Make sure that physical volume is available to add. Execute vgs of vgdisplay to check extended volume group and vgreduce can out the volume from volume group but it can create complications.


As volume grous, locgical volumes can be exteneded. you can use lvextend command Most of filesystem resizing can be done online without monting filsystem.

to grow the logical volume size, lvresize or lvextend followed by -r option to resize the file system used on it, then specify the size you want to resize. Simple use -L +size to add disk space.

Few examples are –

  • #lvresize -r -l 75%VG-STORAGE /dev/VG-STORAGE/lv-DATA (takes 75% of disk space)
  • lvresize -r -l +75%VG /dev/vgdata/lvdata (adds 75% of  disk space)
  • lvresize -r -l +75%FREE /dev/vgdata/lvdata (adds 75% of all free disk space to logical volume)
  • lvresize -r -l 75%FREE /dev/vgdata/lvdata (resizes the logical volume to total size that equals 75% of the amount of free disk space.)




Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">