What Is LVM (Logical Volume Manager)

Describes what is LVM (Logical Volume Manager) on Linux systems. Commands are provides on how to display LVM related information.

What Is LVM (Logical Volume Manager)? - LVM is a storage manager that allows you to create a single or multiple logical storage volumes across multiple physical disks or partitions.

There are 3 basic concepts used by LVM:

The diagram (source: opensource.com) below provides a good illustration of how PV, VG and LV work together to support file systems.

LVM (Logical Volume Manager)
LVM (Logical Volume Manager)

Main features of LVM:

Here is what I did to find out what logical volumes are used on my CentOS computer.

1. List PVs with "pvs" command. The output shows that I have 3 physical volumes, 2 created from 2 partitions on the first hard disk /dev/sda; 1 created from 1 partition on the second hard disk /dev/sdb.

herong$ sudo pvs
  PV         VG   Fmt  Attr PSize   PFree
  /dev/sda7  cl   lvm2 a--   96.65g      0
  /dev/sdb2  cl   lvm2 a--  931.69g 731.69g
  /dev/sdb3  data lvm2 a--   93.13g  83.13g

2. List VGs with "vgs" command. The output shows that I have 2 virtual groups called "cl" and "data".

herong$ sudo vgs
  VG   #PV #LV #SN Attr   VSize   VFree
  cl     2   3   0 wz--n-   1.00t 731.69g
  data   1   1   0 wz--n-  93.13g  83.13g

3. List LVs with "lvs" command. The output shows that I have 3 LVs "home", "root" and "swap", created on the "cl" Volume Group.

herong$ sudo lvs
  LV    VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log ...
  home  cl   -wi-ao---- 238.94g
  root  cl   -wi-ao----  50.00g
  swap  cl   -wi-ao----   7.71g
  share data -wi-a-----  10.00g

4. List LVs mounting points with the "df" command. "cl-root" and "cl-home" LVs are mounted. "cl-swap" and "share-data" are not mounted.

herong$ df | grep mapper
/dev/mapper/cl-root   52403200  29581652  22821548  57% /
/dev/mapper/cl-home  250528288 130413944 120114344  53% /home

Based on outputs from above commands, logical volumes, virtual groups and physical volumes on my computer are working together as shown below:

Logical Volumes, Virtual Groups and Physical Volumes Relations
Logical Volumes, Virtual Groups and Physical Volumes Relations

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

 Files and Directories

 Users and Groups

 File Systems

 Block Devices and Partitions

LVM (Logical Volume Manager)

What Is LVM (Logical Volume Manager)

 Create New PV (Physical Volume)

 Add/Remove PV on VG on the Fly

 Create LV on VG on the Fly

 Extend /home LV with a New Partition

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Software Package Manager on CentOS - DNF and YUM

 vsftpd - Very Secure FTP Daemon

 Postfix - Mail Transport Agent (MTA)

 Dovecot - IMAP and POP3 Server

 Email Client Tools - Mail User Agents (MUA)

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB