Lab activity

Logical Volume Management (LVM)

Learn how to configure and manage Linux Logical Volume Management (LVM) by creating physical volumes, volume groups, and logical volumes, formatting and mounting volumes, and extending storage capacity.

Overview

In this lab, you will learn how to configure Logical Volume Management (LVM) using virtual disk images as simulated physical disks. You will create Physical Volumes (PVs), combine them into a Volume Group (VG), and create Logical Volumes (LVs). You will format and mount a logical volume with ext4, create test files, extend the logical volume and filesystem, and add another physical volume to expand the volume group's capacity. Finally, you will remove the LVM components and clean up the lab environment.

Learning Outcomes

  • Install the lvm2 package and prepare virtual disk images using loop devices.
  • Create and inspect Physical Volumes using pvcreate, pvs, and pvdisplay.
  • Create and inspect a Volume Group using vgcreate, vgs, and vgdisplay.
  • Create and inspect Logical Volumes using lvcreate, lvs, and lvdisplay.
  • Format a logical volume with ext4 and mount it to a directory.
  • Extend a logical volume using lvextend and resize its ext4 filesystem with resize2fs.
  • Add another Physical Volume to an existing Volume Group using vgextend.

Key Concepts

  • Physical Volumes (PVs): Storage devices initialized for use by LVM.
  • Volume Groups (VGs): Storage pools formed by combining one or more Physical Volumes.
  • Logical Volumes (LVs): Flexible virtual storage volumes allocated from a Volume Group.
  • Filesystem management: Format logical volumes with ext4, mount them, and create files.
  • Logical volume extension: Allocate additional space to a logical volume and resize its filesystem to use the new capacity.
  • Volume group expansion: Add another Physical Volume to increase the available storage in an existing Volume Group.
  • LVM inspection and cleanup: Use LVM utilities to inspect storage configuration and remove resources when they are no longer needed.

Why Needed?

  • LVM provides flexible storage management by separating logical storage volumes from the underlying physical devices.
  • Extending logical volumes and volume groups helps administrators respond to changing storage requirements.
  • Understanding PVs, VGs, and LVs is useful for managing storage in Linux servers and virtualized environments.
  • These hands-on exercises build practical storage administration skills for LFCS preparation and real-world Linux system management.