Skip to content

Lvm

Comprehensive Linux Logical Volume Management

Section titled “Comprehensive Linux Logical Volume Management”

LVM (Logical Volume Manager) is a device mapper framework that provides logical volume management for the Linux kernel. It allows for flexible disk storage management, including resizing, snapshots, and thin provisioning.

┌────────────────────────────────────────────────────────────────────────┐
│ LVM ARCHITECTURE LAYERS │
├────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ USER SPACE │ │
│ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │
│ │ │ pvcreate │ │ vgcreate │ │ lvcreate │ │ lvm │ │ │
│ │ │ pvs │ │ vgs │ │ lvs │ │ tools │ │ │
│ │ └────────────┘ └────────────┘ └────────────┘ └────────────┘ │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ KERNEL MODULES │ │
│ │ ┌──────────────────────────────────────────────────────────┐ │ │
│ │ │ device-mapper (dm.ko) │ │ │
│ │ │ dm-mod.ko (snapshot, thin, cache, mirror, raid) │ │ │
│ │ └──────────────────────────────────────────────────────────┘ │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ DEVICE MAPPER │ │
│ │ │ │
│ │ /dev/mapper/vg_name-lv_name ──► /dev/dm-0, /dev/dm-1 │ │
│ │ /dev/vg_name/lv_name ──► Symlink to above │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────────────────┘
ComponentAbbreviationDescriptionExample
Physical VolumePVPartition or disk initialized for LVM/dev/sdb1
Volume GroupVGPool of storage from PVsvg_data
Logical VolumeLVVirtual partitions from VGslv_data
Physical ExtentPESmallest allocatable unit (4MB default)4MB chunk
Logical ExtentLEMaps to PE for allocation4MB chunk
Volume DescriptorVGDAMetadata at start of PVMetadata
┌────────────────────────────────────────────────────────────────────────┐
│ LVM DATA FLOW │
├────────────────────────────────────────────────────────────────────────┤
│ │
│ Physical Disk │
│ ┌─────────────┐ │
│ │ /dev/sdb │ │
│ │ │ │
│ │ ┌─────────┐ │ ┌─────────────────┐ ┌──────────────────┐ │
│ │ │/dev/sdb1│ │────►│ Physical Volume │ │ /dev/sdb1 │ │
│ │ │ Partition│ │ │ (PV Header) │ │ PV Header │ │
│ │ └─────────┘ │ └─────────────────┘ │ PE Table │ │
│ └─────────────┘ └──────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Volume Group (VG) │ │
│ │ │ │
│ │ ┌───────────────────────────────────────────────┐ │ │
│ │ │ Physical Extents │ │ │
│ │ │ PE0 PE1 PE2 PE3 PE4 PE5 PE6 PE7 │ │ │
│ │ │ ▓▓▓ ▓▓▓ ░░ ░░ ███ ███ ▓▓▓ ▓▓▓ │ │ │
│ │ │ (used) (free) (used) (used) │ │ │
│ │ └───────────────────────────────────────────────┘ │ │
│ │ │ │ │
│ │ ▼ │ │
│ │ ┌───────────────────────────────────────────────┐ │ │
│ │ │ Logical Extents │ │ │
│ │ │ LE0 LE1 LE2 LE3 LE4 LE5 LE6 LE7 │ │ │
│ │ │ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ███ ███ ███ ███ │ │ │
│ │ │ (lv_data) (lv_logs) │ │ │
│ │ └───────────────────────────────────────────────┘ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Logical Volumes (LV) │ │
│ │ │ │
│ │ ┌──────────────────────┐ ┌──────────────────────┐ │ │
│ │ │ /dev/vg_data/ │ │ /dev/vg_data/ │ │ │
│ │ │ lv_data │ │ lv_logs │ │ │
│ │ │ (100GB) │ │ (50GB) │ │ │
│ │ └──────────────────────┘ └──────────────────────┘ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Filesystem │ │
│ │ │ │
│ │ ┌──────────────────────┐ ┌──────────────────────┐ │ │
│ │ │ /dev/mapper/ │ │ /dev/mapper/ │ │ │
│ │ │ vg_data-lv_data │ │ vg_data-lv_logs │ │ │
│ │ │ (ext4/xfs) │ │ (ext4/xfs) │ │ │
│ │ └──────────────────────┘ └──────────────────────┘ │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────────────────┘

Terminal window
# Debian/Ubuntu
sudo apt-get install lvm2
# RHEL/CentOS/Fedora
sudo yum install lvm2
# or
sudo dnf install lvm2
# Arch Linux
sudo pacman -S lvm2
# Verify installation
lvm version
Terminal window
# Using fdisk to create partition
sudo fdisk /dev/sdb
# In fdisk:
# n - new partition
# p - primary partition
# 1 - partition number
# Enter - default first sector
# Enter - default last sector (use whole disk)
# t - change partition type
# 8e - Linux LVM type
# w - write and quit
# Alternative: Use parted
sudo parted /dev/sdb
(parted) mklabel gpt
(parted) mkpart primary 0% 100%
(parted) set 1 lvm on
(parted) quit

Terminal window
# Create PV on single disk
sudo pvcreate /dev/sdb1
# Create PV on multiple disks
sudo pvcreate /dev/sdb1 /dev/sdc1 /dev/sdd1
# Force creation (if disk has existing data)
sudo pvcreate -ff /dev/sdb1
# View PV information
sudo pvs # Brief summary
sudo pvdisplay # Detailed info
sudo pvdisplay /dev/sdb1 # Specific PV
# PV details with specific fields
sudo pvs -o +pv_used,pv_free
Terminal window
# Create VG from single PV
sudo vgcreate vg_data /dev/sdb1
# Create VG from multiple PVs
sudo vgcreate vg_data /dev/sdb1 /dev/sdc1
# Create VG with specific PE size
sudo vgcreate -s 8M vg_data /dev/sdb1
# Add PV to existing VG
sudo vgextend vg_data /dev/sdd1
# Remove PV from VG
sudo vgreduce vg_data /dev/sdd1
# View VG information
sudo vgs # Brief summary
sudo vgs -a # Show all VGs
sudo vgdisplay # Detailed info
sudo vgdisplay vg_data # Specific VG
Terminal window
# Create LV with fixed size
sudo lvcreate -L 10G -n lv_data vg_data
# Create LV using all free space
sudo lvcreate -l 100%FREE -n lv_backup vg_data
# Create LV using percentage of VG
sudo lvcreate -l 50%VG -n lv_data vg_data
# Create LV with specific PE count
sudo lvcreate -l 2560 -n lv_data vg_data
# Create linear LV (default)
sudo lvcreate -L 20G -n lv_linear vg_data
# Create striped LV (for performance)
sudo lvcreate -L 20G -i 3 -n lv_striped vg_data
# -i 3 = 3 stripes across PVs
# Create mirrored LV
sudo lvcreate -L 10G -m 1 -n lv_mirror vg_data
# -m 1 = 1 mirror copy
# View LV information
sudo lvs # Brief summary
sudo lvs -a # Show all LVs
sudo lvdisplay # Detailed info
sudo lvdisplay /dev/vg_data/lv_data
Terminal window
# Create ext4 filesystem
sudo mkfs.ext4 /dev/vg_data/lv_data
# Create XFS filesystem
sudo mkfs.xfs /dev/vg_data/lv_data
# Create with specific block size
sudo mkfs.ext4 -b 4096 /dev/vg_data/lv_data
# Mount temporarily
sudo mount /dev/vg_data/lv_data /mnt/data
# Mount persistently (/etc/fstab)
# /dev/mapper/vg_data-lv_data /mnt/data ext4 defaults 0 2
# Verify mount
df -h /mnt/data

Terminal window
# Extend LV by specific size
sudo lvextend -L +10G /dev/vg_data/lv_data
# Extend LV to specific size
sudo lvextend -L 50G /dev/vg_data/lv_data
# Extend to use all free space
sudo lvextend -l +100%FREE /dev/vg_data/lv_data
# Extend with specific PE
sudo lvextend -l +2560 /dev/vg_data/lv_data
# Online extension (without unmounting)
# For ext4
sudo resize2fs /dev/vg_data/lv_data
# For XFS (online, no unmount needed)
sudo xfs_growfs /mnt/data
# Check result
sudo lvs
df -h /mnt/data
Terminal window
# WARNING: Reducing LV can cause data loss!
# Always backup first!
# Unmount the filesystem
sudo umount /mnt/data
# Check filesystem
sudo e2fsck -f /dev/vg_data/lv_data
# Resize filesystem to new smaller size
sudo resize2fs /dev/vg_data/lv_data 20G
# Reduce LV
sudo lvreduce -L 20G /dev/vg_data/lv_data
# Remount
sudo mount /dev/vg_data/lv_data /mnt/data
# Alternative: Use lvreduce with -r (auto-resize filesystem)
# This combines the above steps:
sudo lvreduce -r -L 20G /dev/vg_data/lv_data
Terminal window
# Remove LV
sudo lvremove /dev/vg_data/lv_data
# Will ask for confirmation
# Force remove (with -f)
sudo lvremove -f /dev/vg_data/lv_data
# Remove VG
sudo vgremove vg_data
# Must remove all LVs first
# Remove PV
sudo pvremove /dev/sdb1
# Must not be part of any VG
Terminal window
# Move all extents from one PV to others
sudo pvmove /dev/sdb1
# Move specific extents
sudo pvmove /dev/sdb1 /dev/sdc1
# Move with progress
sudo pvmove -i 10 /dev/sdb1
# Note: Can take long time for large volumes
# Use screen or tmux for long operations

Terminal window
# Create snapshot (read-only by default)
sudo lvcreate -L 5G -s -n lv_snap /dev/vg_data/lv_data
# Create writable snapshot
sudo lvcreate -L 5G -s -n lv_snap_rw /dev/vg_data/lv_data
# Note: Changes won't persist after merge
# Create snapshot with specific extents
sudo lvcreate -l 1000 -s -n lv_snap /dev/vg_data/lv_data
# View snapshots
sudo lvs -a
sudo lvdisplay /dev/vg_data/lv_snap
Terminal window
# Mount snapshot (read-only)
sudo mkdir /mnt/snap
sudo mount -o ro /dev/vg_data/lv_snap /mnt/snap
# Browse snapshot contents
ls /mnt/snap
sudo cp -a /mnt/snap /backup/snapshot-$(date +%Y%m%d)
# Unmount
sudo umount /mnt/snap
Terminal window
# Method 1: Merge snapshot into original
# This reverts the original LV to snapshot state
# All changes since snapshot creation are lost
# Unmount original filesystem
sudo umount /mnt/data
# Merge snapshot
sudo lvconvert --merge /dev/vg_data/lv_snap
# Mount restored volume
sudo mount /dev/vg_data/lv_data /mnt/data
# Note: Snapshot is removed after merge
# Method 2: Create new LV from snapshot
sudo lvcreate -L 10G -n lv_restored -s /dev/vg_data/lv_data
# Mount and copy data
sudo mount /dev/vg_data/lv_restored /mnt/restored
cp -a /mnt/restored/* /new/location/
Terminal window
# View snapshot status
sudo lvdisplay /dev/vg_data/lv_snap
# Check snapshot space usage
sudo lvs -o+lv_sn%_size
# Remove snapshot
sudo lvremove /dev/vg_data/lv_snap
# Extend snapshot
sudo lvextend -L +2G /dev/vg_data/lv_snap
# Check what snapshot is full
sudo lvs -a | grep snap

Terminal window
# Create thin pool
sudo lvcreate -L 100G --thinpool vg_data/thin_pool
# Create thin pool with metadata size
sudo lvcreate -L 100G --metadatavol 1G --thinpool vg_data/thin_pool
# View thin pool
sudo lvs -a
sudo lvs -o +thin_pool,thin_size,data_size
Terminal window
# Create thin volume (virtual size can exceed physical)
sudo lvcreate -V 200G --thin -n thin_data vg_data/thin_pool
# View thin volumes
sudo lvs -a
# Create thin volume with specific virtual size
sudo lvcreate -V 500G --thin -n thin_archive vg_data/thin_pool
# Extend thin pool
sudo lvextend -L +50G vg_data/thin_pool
Terminal window
# Monitor thin pool usage
sudo lvs -o lv_name,thin_size,data_size,metadata_size,thin_percent
# Check pool full percentage
sudo lvs -o lv_name,data_percent
# Example output:
# LV Thin Size Data Size Metadata %Used
# thin_pool 100.00g 100.00g 1.00g 45.00
# thin_data 500.00g Pool data
Terminal window
# Enable autoextension
sudo lvchange --autobackup y --thinpool vg_data/thin_pool
# Set autoextend threshold
sudo lvchange --thinpool_autoextend_threshold 80 --thinpool_autoextend_percent 20 vg_data/thin_pool
# Trim unused space (if supported)
sudo fstrim /mnt/thin_data

RAID LevelLVM OptionDescription
RAID 0-iStriping (performance, no redundancy)
RAID 1-m 1Mirroring (redundancy)
RAID 4-m 1 —type raid4Dedicated parity
RAID 5-m 1 —type raid5Distributed parity
RAID 6-m 2 —type raid6Double parity
RAID 10-m 1 -i 2Striped mirrors
Terminal window
# Create 2-way mirror
sudo lvcreate -L 20G -m 1 -n lv_mirror vg_data
# Create 2-way mirror on specific PVs
sudo lvcreate -L 20G -m 1 -n lv_mirror vg_data /dev/sdb1 /dev/sdc1 /dev/sdd1
# Convert existing LV to mirror
sudo lvconvert -m 1 /dev/vg_data/lv_data /dev/sdc1
# Remove mirror (keep data on one disk)
sudo lvconvert -m 0 /dev/vg_data/lv_data /dev/sdb1
Terminal window
# Create 3-stripe RAID0
sudo lvcreate -L 30G -i 3 -n lv_striped vg_data
# Create stripe on specific PVs
sudo lvcreate -L 30G -i 3 -n lv_striped vg_data /dev/sdb1 /dev/sdc1 /dev/sdd1
# Extend striped LV (must add PVs)
sudo vgextend vg_data /dev/sde1
sudo lvextend -i 3 -l +100%FREE /dev/vg_data/lv_striped
Terminal window
# Check RAID status
sudo lvs -a -o lv_name,lv_health_status,devices
# Repair failed mirror
sudo lvconvert --repair /dev/vg_data/lv_mirror
# Replace failed disk
sudo lvconvert --replace /dev/sdb1 /dev/vg_data/lv_mirror /dev/sdc1
# Monitor resync
sudo lvs -o lv_name,sync_percent

Terminal window
# Create cache pool from fast SSD
sudo lvcreate -L 20G -n cache_pool vg_data /dev/ssd1
# Create cache volume from pool
sudo lvcreate -L 20G -n cache_data vg_data /dev/ssd1
# Attach cache to LV
sudo lvconvert --type cache-pool /dev/vg_data/lv_data
# Or using cache pool
sudo lvconvert --type cache --cachepool vg_data/cache_pool /dev/vg_data/lv_data
# Verify cache
sudo lvs -o lv_name,cache_mode,cache_policy
ModeDescriptionBest For
writethroughWrite to both, acknowledge after slowData safety priority
writebackWrite to fast first, then slowPerformance priority
passthroughBypass cacheMigration/safety
Terminal window
# Change cache mode
sudo lvchange --cachemode writethrough /dev/vg_data/lv_data
# Detach cache (split cache pool)
sudo lvconvert --splitcache /dev/vg_data/lv_data
# Remove cache
sudo lvremove /dev/vg_data/cache_pool

IssueSymptomsSolution
PV not foundVG won’t activateCheck device, run pvscan
No free spaceLV extension failsAdd PV or remove snapshots
Snapshot fullRead-only snapshotExtend snapshot or remove
VG activation failsSystem won’t bootCheck /etc/lvm/archive
Corrupted metadataCan’t access VGRestore from archive
Disk failurePV missingUse pvmove, replace disk
Terminal window
# Scan for all PVs
sudo pvscan
# Scan for VGs
sudo vgscan
# Scan for LVs
sudo lvscan
# Display detailed PV info
sudo pvdisplay -v
# Display detailed VG info
sudo vgdisplay -v
# Display detailed LV info
sudo lvdisplay -v
# Check LVM configuration
sudo lvm dumpconfig
# View LVM logs
sudo less /var/log/lvm.log
# Kernel device mapper info
sudo dmsetup info
sudo dmsetup table
# Check /proc/mdstat for LVM devices
cat /proc/mdstat
Terminal window
# List archived VG metadata
ls /etc/lvm/archive/
# Restore VG from archive
sudo vgcfgrestore -f /etc/lvm/archive/vg_data_00001-123456789.vg vg_data
# List backup files
sudo vgcfgrestore --list vg_data
# Force restore (if needed)
sudo vgcfgrestore -f /etc/lvm/archive/vg_data_*.vg vg_data
Terminal window
# If PV is missing but data intact
sudo vgchange -a n vg_data # Deactivate
sudo vgchange -a y vg_data # Reactivate (if fixed)
# Recreate missing PV
sudo pvcreate --restorefile /etc/lvm/backup/vg_data /dev/sdb1
sudo vgcfgrestore vg_data
# If LVM won't start
sudo lvm pvscan
sudo vgscan
sudo lvchange -a y /dev/vg_data/lv_data
# Emergency mount (read-only)
sudo mount -o ro /dev/mapper/vg_data-lv_data /mnt/rescue

Terminal window
# Physical volumes on fast storage
sudo pvcreate /dev/nvme0n1p1
sudo pvcreate /dev/nvme0n1p2
# Create volume groups
sudo vgcreate vg_db /dev/nvme0n1p1
sudo vgcreate vg_logs /dev/nvme0n1p2
# Database data (fast SSD/NVMe)
sudo lvcreate -L 200G -n lv_data vg_db
sudo mkfs.xfs /dev/vg_db/lv_data
# Database logs
sudo lvcreate -L 100G -n lv_logs vg_logs
sudo mkfs.xfs /dev/vg_logs/lv_logs
# Archive/backup (slow storage)
sudo pvcreate /dev/sdb1
sudo vgcreate vg_backup /dev/sdb1
sudo lvcreate -L 500G -n lv_backup vg_backup
Terminal window
# Create PV
sudo pvcreate /dev/sdb1
# Create VG
sudo vgcreate vg_web /dev/sdb1
# Webroot
sudo lvcreate -L 50G -n lv_www vg_web
sudo mkfs.ext4 /dev/vg_web/lv_www
# Logs (separate to manage space)
sudo lvcreate -L 20G -n lv_log vg_web
sudo mkfs.ext4 /dev/vg_web/lv_log
# Tmp
sudo lvcreate -L 10G -n lv_tmp vg_web
sudo mkfs.ext4 /dev/vg_web/lv_tmp
Terminal window
# Daily snapshot of data LV
sudo lvcreate -L 20G -s -n lv_data_daily /dev/vg_data/lv_data
# Weekly snapshot
sudo lvcreate -L 40G -s -n lv_data_weekly /dev/vg_data/lv_data
# Backup script
#!/bin/bash
# /usr/local/bin/backup-lvm.sh
set -e
DATE=$(date +%Y%m%d)
sudo lvcreate -L 20G -s -n lv_backup_$DATE /dev/vg_data/lv_data
sudo mount -o ro /dev/vg_data/lv_backup_$DATE /mnt/snap
sudo tar -czf /backup/lv_data_$DATE.tar.gz -C /mnt/snap .
sudo umount /mnt/snap
sudo lvremove -f /dev/vg_data/lv_backup_$DATE

Q1: What are the three main components of LVM?

Section titled “Q1: What are the three main components of LVM?”

Answer:

  1. Physical Volume (PV): A partition or whole disk that has been initialized for use by LVM. Contains LVM headers and physical extents.
  2. Volume Group (VG): A collection of one or more PVs. Acts as a pool of storage that can be allocated to logical volumes.
  3. Logical Volume (LV): Virtual partitions created from a VG. These are what users and applications interact with, like regular partitions.

Data flow: Physical disks/partitions (PV) → Pooled storage (VG) → Virtual partitions (LV) → Filesystem

Q2: What is the difference between LVM thin provisioning and regular LVM?

Section titled “Q2: What is the difference between LVM thin provisioning and regular LVM?”

Answer:

  • Regular LVM: Logical volumes are allocated with a fixed size that uses physical space immediately
  • Thin Provisioning: Logical volumes can be created with virtual sizes larger than physically available storage. Space is allocated only as data is written

Benefits of thin provisioning:

  • Over-commitment of storage
  • More efficient space utilization
  • Ability to create many large volumes
  • Better for virtual environments

Q3: How do you extend a logical volume online?

Section titled “Q3: How do you extend a logical volume online?”

Answer:

Terminal window
# Extend the LV
sudo lvextend -L +10G /dev/vg_data/lv_data
# Resize filesystem (ext4)
sudo resize2fs /dev/vg_data/lv_data
# For XFS (online, no unmount needed)
sudo xfs_growfs /mount/point

For ext4, you can extend while mounted in recent kernels. For XFS, always online-extendable.

Q4: What is an LVM snapshot and how does it work?

Section titled “Q4: What is an LVM snapshot and how does it work?”

Answer: An LVM snapshot is a read-only copy of a logical volume at a specific point in time. It works using copy-on-write:

  • When created, snapshot uses minimal space
  • When data changes on original LV, old data is copied to snapshot before overwrite
  • Snapshot grows as changes accumulate
  • Can be used for backups, testing, or recovery

Snapshots are temporary - they must be explicitly removed or merged.

Q5: How do you recover from a failed disk in an LVM setup?

Section titled “Q5: How do you recover from a failed disk in an LVM setup?”

Answer:

  1. Identify failed disk: sudo pvs shows failed PV
  2. If mirror/RAID: LVM automatically recovers if configured
  3. For linear/striped:
    • Replace failed disk
    • Create new PV: sudo pvcreate /dev/newdisk
    • Add to VG: sudo vgextend vg_name /dev/newdisk
    • Move data: sudo pvmove /dev/failed_disk /dev/newdisk
    • Remove failed: sudo vgreduce vg_name /dev/failed_disk

Q6: What is the difference between lvreduce and lvresize?

Section titled “Q6: What is the difference between lvreduce and lvresize?”

Answer:

  • lvreduce: Specifically reduces LV size
  • lvresize: Can both increase and decrease LV size
  • In practice, lvresize is more commonly used as it handles both directions

Both require:

  1. Unmounting the filesystem (for reduction)
  2. Running filesystem check (e2fsck)
  3. Resizing filesystem before reducing LV

Answer:

Terminal window
# VG free space
sudo vgs
# LV usage
sudo lvs -o lv_name,lv_size,data_percent
# Thin pool usage
sudo lvs -o lv_name,thin_size,data_size,metadata_size
# PV space
sudo pvs
# Detailed info
sudo pvdisplay -m # shows extent mapping

Q8: What are LVM cache volumes and when would you use them?

Section titled “Q8: What are LVM cache volumes and when would you use them?”

Answer: LVM cache uses fast storage (SSD) to cache data from slower storage (HDD):

  • Creates a small logical volume on fast storage
  • Attaches as cache to slow LV
  • Frequently accessed data stays in fast storage
  • Improves performance without replacing all storage

Use cases:

  • Hybrid storage (SSD + HDD)
  • Caching database writes
  • Accelerating file servers

Terminal window
# Physical Volume
pvcreate /dev/sdb1
pvs
pvdisplay
pvremove /dev/sdb1
# Volume Group
vgcreate vg_data /dev/sdb1
vgs
vgdisplay
vgextend vg_data /dev/sdc1
vgreduce vg_data /dev/sdb1
vgremove vg_data
# Logical Volume
lvcreate -L 10G -n lv_data vg_data
lvs
lvdisplay
lvextend -L +10G /dev/vg_data/lv_data
lvreduce -L 10G /dev/vg_data/lv_data
lvremove /dev/vg_data/lv_data
# Snapshots
lvcreate -L 5G -s -n lv_snap /dev/vg_data/lv_data
lvconvert --merge /dev/vg_data/lv_snap
# Thin Provisioning
lvcreate -L 100G --thinpool vg_data/thin_pool
lvcreate -V 200G --thin -n thin_vol vg_data/thin_pool
TypePath
LV (mapper)/dev/mapper/vg_name-lv_name
LV (by-id)/dev/vg_name/lv_name
LV (by-uuid)/dev/disk/by-uuid/uuid

In this chapter, you learned:

  • ✅ LVM architecture and components (PV, VG, LV)
  • ✅ Creating physical volumes, volume groups, and logical volumes
  • ✅ Extending and reducing logical volumes
  • ✅ LVM snapshots for backups and recovery
  • ✅ Thin provisioning for efficient storage
  • ✅ LVM RAID and mirroring
  • ✅ LVM caching for hybrid storage
  • ✅ Troubleshooting and recovery
  • ✅ Production configuration examples
  • ✅ Interview questions and answers

Chapter 14: Mounting and fstab


Last Updated: February 2026