Note: This is an RHCSA 7 exam objective.


Before dealing with physical volumes, volume groups and logical volumes, you need to know how to create partitions on disk.

LVM Presentation

LVM stands for Logical Volume Manager. It’s the system component that is able to deal with partitions in a modern way.

Traditionally, Unix disks were divided into slices called partitions. It was possible to decide the size of each partition but, once done, you couln’t change it without destroying all data on it.

With LVM, you can allocate disk space in a flexible manner.

LVM relies on three main concepts:

  • physical volume or pv: a pv is a whole disk or a partition of a disk,
  • volume group or vg: a vg contains one or more pv; a pv can only belong to one vg,
  • logical volume or lv: a lv represents a portion of a vg; a lv can only belong to one vg; it’s on a lv that you can create a file system.

LVM brings flexibility compared to the previous system only based on partitions:

  • you can easily increase the size of a logical volume if you’ve got some space available in the associated volume group,
  • if you don’t have any available space anymore, you can add a new disk as a physical volume, add it to the volume group and increase the size of your logical volume: the logical volume will span two or more disks without any additional operations,
  • creating or extending logical volumes don’t require any downtime.

Configuration Report

Before starting any operation, you need to know the current configuration. Type:

# lsblk -a
vda           252:0    0    6G  0 disk 
├─vda1        252:1    0  390M  0 part /boot
└─vda2        252:2    0  5.5G  0 part 
  ├─rhel-swap 253:0    0  552M  0 lvm  [SWAP]
  └─rhel-root 253:1    0    3G  0 lvm  /

With the lsblk command, you get quickly the following information:

  • it is a virtual machine (vda, sda would indicate a physical server),
  • there is only one disk /dev/vda of 6GB,
  • the disk is divided into two partitions (vda1 and vda2) respectively with a size of 390MB and 5.5GB,
  • the vda1 partition is mounted under /boot,
  • the vda2 partition consists in two logical volumes (lvm) swap and root in a volume group called rhel,
  • the swap logical volume is used by the system as a swapping area ([SWAP]) of 552MB,
  • the root logical volume is mounted under / with a size of3GB,
  • there is around 2GB of free available space (5.5GB552MB3GB=2GB) in the vda2 partition,
  • none of the partitions are in Read-Only mode (RO=0) or ReMovable (RM=0).

Note1: lsblk should be the first command to type when dealing with partitions. Note2: By default, the lsblk command doesn’t display empty devices. The -a option corrects this problem.

Physical Volume Management

To create a physical volume (here /dev/vda), type:

# pvcreate /dev/vda

To remove a physical volume not belonging to any volume group (here /dev/vda), type:

# pvremove /dev/vda

To get the list of the physical volumes, type:

# pvs

Volume Group Management

To create a volume group (here called vg using a physical volume /dev/vda) with a physical extent size of 8MB, type:

# vgcreate -s 8m vg /dev/vda

To add a physical volume (here /dev/vdb) to an existing volume group (here vg), type:

# vgextend vg /dev/vdb

To remove a physical volume (here /dev/vdb) from an existing volume group (here vg), type:

# vgreduce vg /dev/vdb

To remove an existing volume group (here called vg), type:

# vgremove vg

To get the list of the volume groups, type:

# vgs

Logical Volume Management

To create a logical volume (here called lv_vol with a size of 1GB in the vg volume group), type:

# lvcreate --size 1G --name lv_vol vg

To remove a logical volume (here called lv_vol in the vg volume group), type:

# lvremove /dev/vg/lv_vol

To get the list of the logical volumes, type:

# lvs

Additional Resources

You can also watch Ralph Nyberg‘s video about LVM (18min/2015) or Red Hat Training‘s Resizing a volume group (5min/2015). Beyond the RHCSA objectives, you can read this tutorial about Creating a Thinly Provisioned Logical Volume.