Skip to content

Linux LVM

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux LVM Guide

Complete beginner-friendly guide to Logical Volume Management (LVM) on Linux, covering Arch Linux, CachyOS, and other distributions including volume groups, logical volumes, and LVM management.


Table of Contents

  1. Understanding LVM
  2. Creating LVM
  3. Managing Volumes
  4. Resizing Volumes
  5. Troubleshooting

Understanding LVM

LVM Components

LVM structure:

  • Physical Volume (PV): Physical disk/partition
  • Volume Group (VG): Collection of PVs
  • Logical Volume (LV): Virtual partition

Benefits:

  • Flexible sizing: Resize volumes easily
  • Multiple disks: Combine multiple disks
  • Snapshots: Create volume snapshots

Creating LVM

Create Physical Volume

Create PV:

# Install LVM
sudo pacman -S lvm2

# Create physical volume
sudo pvcreate /dev/sda2

# Check
sudo pvs

Create Volume Group

Create VG:

# Create volume group
sudo vgcreate myvg /dev/sda2

# Check
sudo vgs

Create Logical Volume

Create LV:

# Create logical volume
sudo lvcreate -L 20G -n mylv myvg

# Check
sudo lvs

Format and Mount

Format LV:

# Format
sudo mkfs.ext4 /dev/myvg/mylv

# Mount
sudo mount /dev/myvg/mylv /mnt/data

Managing Volumes

List Volumes

List LVM components:

# List physical volumes
sudo pvs

# List volume groups
sudo vgs

# List logical volumes
sudo lvs

Remove Volumes

Remove LV:

# Unmount first
sudo umount /mnt/data

# Remove logical volume
sudo lvremove /dev/myvg/mylv

Resizing Volumes

Resize Logical Volume

Extend LV:

# Extend logical volume
sudo lvextend -L +10G /dev/myvg/mylv

# Resize filesystem
sudo resize2fs /dev/myvg/mylv

Shrink LV:

# Shrink filesystem first
sudo resize2fs /dev/myvg/mylv 20G

# Shrink logical volume
sudo lvreduce -L 20G /dev/myvg/mylv

Troubleshooting

LVM Not Working

Check status:

# Check volumes
sudo pvs
sudo vgs
sudo lvs

# Check modules
lsmod | grep dm

Summary

This guide covered LVM for Arch Linux, CachyOS, and other distributions, including creation, management, and resizing.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally