Operations 10 min read

Master LVM: Concepts, Commands, and Step‑by‑Step Setup Guide

This article provides a comprehensive overview of Logical Volume Manager (LVM), explains its core concepts such as physical volumes, volume groups, logical volumes and physical extents, outlines its main advantages, and walks through essential management commands with practical examples for creating, extending and removing LVM components.

Open Source Linux
Open Source Linux
Open Source Linux
Master LVM: Concepts, Commands, and Step‑by‑Step Setup Guide

LVM (Logical Volume Manager): Overview, Principles, Management Commands, Creation Steps

1. LVM Overview

Logical Volume Manager (LVM) is a disk management mechanism that allows flexible resizing of storage without affecting existing data, improving the agility of disk management for system administrators.

LVM’s advantages include dynamic expansion and reduction of file systems, simplifying storage resource management.

Basic Concepts

PV (Physical Volume)

Physical Volume is the basic storage unit of LVM. It can be an entire physical disk or a disk partition and serves as the foundation for creating volume groups.

VG (Volume Group)

Volume Group is a storage pool composed of one or more physical volumes. It aggregates the space of its physical volumes and provides a unified resource for creating logical volumes. Volume groups can dynamically add or remove physical volumes to adjust capacity.

LV (Logical Volume)

Logical Volume is storage allocated from a volume group. It behaves like a traditional partition but offers greater flexibility, allowing size adjustments without affecting the data it contains. Logical volumes are used to create and manage file systems.

PE (Physical Extent)

Physical Extent is the smallest allocation unit within a volume group. Each physical volume is divided into equal‑sized PEs when added to a group, and logical volumes are built from these PEs, enabling fine‑grained storage management.

/boot Partition

The /boot partition stores boot files and cannot be created on LVM. It contains the bootloader and kernel, which must be directly accessible during system startup, so it typically uses a standard physical partition.

LVM’s Main Advantages

Dynamic storage adjustment : LVM allows resizing logical volumes while the system is running.

Simplified disk management : By aggregating multiple physical volumes into a volume group, adding or removing disks becomes easier.

Snapshot capability : LVM can create snapshots of logical volumes for backup and recovery.

Improved storage utilization : LVM reduces fragmentation and unused space.

Reasons to Use LVM

Flexibility : Dynamically allocate and adjust storage to meet application needs.

Reliability : Supports hot backup and data migration; can recover data without downtime when a disk fails.

Manageability : Centralized monitoring and management of multiple physical disks and logical volumes.

Performance : Block‑level operations and parallel processing across disks improve I/O speed.

High availability : Supports RAID‑like redundancy across physical volumes for fault tolerance.

2. LVM Management Commands

Main Commands

Scan : pvscan, vgscan, lvscan Create : pvcreate, vgcreate, lvcreate Display : pvdisplay, vgdisplay, lvdisplay Remove : pvremove, vgremove, lvremove Extend : vgextend, lvextend Reduce : vgreduce,

lvreduce

Common Commands with Examples

1. Create Physical Volume – pvcreate

pvcreate

creates a physical volume on a specified device.

pvcreate /dev/sda1 /dev/sdb1

2. Create Volume Group – vgcreate

vgcreate

creates a volume group from one or more physical volumes.

vgcreate my_volume_group /dev/sda1 /dev/sdb1

3. Create Logical Volume – lvcreate

lvcreate

creates a logical volume within a volume group.

lvcreate -L 10G -n my_logical_volume my_volume_group

4. Extend Logical Volume – lvextend

lvextend

expands an existing logical volume.

lvextend -L +5G /dev/my_volume_group/my_logical_volume

3. LVM Application Steps

Recommended Procedure

Prerequisite: install the lvm2 package.

Sequence: PV → VG → LV → format & mount.

Step 1: Convert Disks to Physical Volumes

pvcreate /dev/sdb1

pvcreate /dev/sdc1

Step 2: Create a Volume Group

vgcreate mail_store /dev/sdb1 /dev/sdc1

Step 3: Create a Logical Volume

lvcreate -L 20G -n mbox mail_store

Step 4: Format and Mount

mkfs.xfs /dev/mail_store/mbox

mount /dev/mail_store/mbox /mailbox

System AdministrationLVMLinux storagedisk-managementLogical Volume Manager
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.