Arch Linux LVM - ryzendew/Linux-Tips-and-Tricks GitHub Wiki

Arch Linux LVM Guide

Complete beginner-friendly guide to Logical Volume Management (LVM) on Arch Linux, 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

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 information:

# List PVs
sudo pvs

# List VGs
sudo vgs

# List LVs
sudo lvs

# Detailed info
sudo pvdisplay
sudo vgdisplay
sudo lvdisplay

Resizing Volumes

Extend Volume

Grow volume:

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

# Resize filesystem
sudo resize2fs /dev/myvg/mylv

Reduce Volume

Shrink volume:

# Resize filesystem first
sudo resize2fs /dev/myvg/mylv 15G

# Reduce LV
sudo lvreduce -L 15G /dev/myvg/mylv

Troubleshooting

Volume Not Found

Activate volume:

# Activate VG
sudo vgchange -ay myvg

# Scan for volumes
sudo vgscan

Summary

This guide covered LVM creation, management, and resizing.


Next Steps


This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.