Skip to content
Master Linux LVM: Step‑by‑Step Guide to Creating and Extending Logical Volumes
Operations 4 min read

Master Linux LVM: Step‑by‑Step Guide to Creating and Extending Logical Volumes

This tutorial explains how to use Linux Logical Volume Management (LVM) to create physical volumes, volume groups, and logical volumes, covering essential commands, formatting, mounting, and expanding storage without data loss, all illustrated with clear examples and screenshots.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations

Logical Volumes

Using hard disks on Linux

Partition

Partitions cannot be expanded; they must be recreated, which leads to data loss.

They require contiguous space on the disk.

Formatting

Mounting

Logical volumes (virtual disks)

Unlimited expansion without affecting data.

Space can be non‑contiguous.

Limited backup capabilities.

Process of creating logical volumes

Physical Volume (PV): split a disk partition into Physical Extents (PE), each 4 MiB.

Benefit: after partitioning, the entire disk becomes a series of 4 MiB PEs.

Volume Group (VG): a collection of PEs for easier management.

Logical Volume (LV): the virtual disk you work with.

Main commands:

Physical volume management : pvscan, pvcreate, pvdisplay, pvremove

Volume group management : vgscan, vgcreate, vgdisplay, vgremove, vgextend

Logical volume management : lvscan, lvcreate, lvdisplay, lvremove, lvextend

Creating a Physical Volume

pvcreate /dev/sdb /dev/sdc

Check with pvdisplay:

If using partitions, change the partition type to 8e before creating the PV.

Creating a Volume Group

vgcreate ky33 /dev/sdb /dev/sdc

Verify with vgdisplay:

Creating a Logical Volume

lvcreate -n chen -L 15G ky33

Check with lvdisplay:

Format the logical volume (e.g., XFS):

Mounting

Mount the logical volume permanently and refresh with mount -a:

Expanding Without Data Loss

If the volume group has enough free space, extend the logical volume directly.

If not, first extend the volume group, then extend the logical volume.

Logical volume expansion command:

lvextend -L +5G <LV_NAME> -r
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxsystem administrationLVMStorage ManagementLogical Volume
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.