Skip to main content
RunBook Academy

LinuxXVI · LVMTroubleshooting

LVM troubleshooting - common failures and how to recover

Intermediate⏱ ~8 minbashlvmpvsvgslvsvgcfgrestore

What you'll learn

  • Diagnose the common LVM failures on a production host
  • Recover from a missing or failed PV
  • Restore from a corrupted LVM metadata header
  • Use vgcfgrestore and /etc/lvm/archive to undo a bad structural change
  • Explain why vgreduce --force deletes logical volumes rather than repairing them

Prerequisites

Verified against Ubuntu 24.04 LTS · Debian 12 (Bookworm) · RHEL 9.x · Rocky Linux 9.x · AlmaLinux 9.x · Linux kernel 6.1 LTS / 6.6 LTS · systemd 255+ · OpenSSH 8.7p1 (RHEL 9) / 9.6p1 (Ubuntu 24.04) · nftables 1.0.x · chrony 4.x · Pacemaker 2.1.x · Corosync 3.1.x · 2026-08-09

Not yet marked complete on this device.

LVM failures are rare but high-impact. The most common cases are a missing PV (disk disappeared), a full VG (no room to grow an LV), and a corrupted metadata header. Each has a clear recovery path.

Missing PV

Read-only / Safemissing PV
$ pvs
  PV         VG   Fmt  Attr PSize  PFree
/dev/sda2  vg0 lvm2 a--  99.00g 5.00g
/dev/sdb1  vg0 lvm2 a--  500.00g 200.00g
unknown    vg0 lvm2 a--  500.00g 500.00g

Recovery is a staged procedure, not a single command. Work down it in order and stop as soon as the problem is solved.

  1. Establish whether the disk is actually gone. A flapping SAN path, a rebooted iSCSI target or a loose cable is not a dead disk, and the PV comes back on its own once the transport recovers.
  2. Snapshot the current metadata to a file you control, before touching anything.
  3. Run the removal as a dry run to see exactly what it would do.
  4. If no logical volume depends on the missing PV, remove it without --force.
  5. Only if logical volumes do depend on it, and only after you have a restorable backup, escalate to --force - which deletes those logical volumes.
# 1. Is the disk really gone?
dmesg -T | tail -50
lsblk
sudo iscsiadm -m session          # iSCSI: is the session up?
sudo multipath -ll                # SAN: are any paths still active?

# 2. Snapshot the current metadata BEFORE touching anything.
sudo vgcfgbackup -f /root/vg0-before-recovery.vg vg0

# 3. See exactly what would be removed. --test changes nothing.
sudo vgreduce --removemissing --test vg0
Data-loss riskremove missing PV (safe form)
$ vgreduce --removemissing vg0; pvs
  PV         VG   Fmt  Attr PSize  PFree
/dev/sda2  vg0 lvm2 a--  99.00g 5.00g
/dev/sdb1  vg0 lvm2 a--  500.00g 200.00g
Data-loss riskremove missing PV (destructive escalation)
# vgreduce --removemissing --force vg0
  WARNING: Partial LV data needs to be repaired or removed.
Removing LV vg0/data from VG vg0
Wrote out consistent volume group vg0.

Undo a bad structural change

ls -lt /etc/lvm/archive/vg0_*.vg        # timestamped, pre-change metadata
sudo vgcfgrestore --list vg0            # pick the seqno from before the mistake
sudo vgcfgrestore -f /etc/lvm/archive/vg0_00042-abcdefgh.vg vg0

# If the PV header itself was wiped, the disk no longer has its UUID.
# Recreate it with the ORIGINAL uuid from the archive file, or the
# restore will not match the metadata:
sudo pvcreate --uuid "kVxi3T-...-original-uuid" \
  --restorefile /etc/lvm/archive/vg0_00042-abcdefgh.vg /dev/sdb1
sudo vgcfgrestore -f /etc/lvm/archive/vg0_00042-abcdefgh.vg vg0
sudo vgchange -ay vg0

A plain pvcreate /dev/sdb1 here would be the second disaster: it writes a new UUID, the archived metadata no longer refers to any disk you have, and the restore becomes impossible. --uuid with --restorefile is what makes the disk answer to its old identity again.

Full VG

Data-loss riskextend with full
$ lvextend -L +100G /dev/vg0/data; lvextend -l +100%FREE /dev/vg0/data
  Insufficient free space: 256 extents needed, but only 0 available
Size of logical volume vg0/data changed from 200.00g to 300.00g

Corrupted metadata

Data-loss riskvgcfgrestore
$ vgcfgrestore vg0
  Restored volume group vg0 with metadata sequence 42
Read-only / Safemetadata backup
$ ls /etc/lvm/backup/vg0*
/etc/lvm/backup/vg0

Knowledge check

Knowledge check · 4 questions

  1. Q1. What command removes a missing PV from a volume group?

  2. Q2. LVM stores a metadata backup in /etc/lvm/backup/ that vgcfgrestore can use.

  3. Q3. Which of the following are correct LVM troubleshooting practices? Select all that apply.

  4. Q4. A SAN path flaps at 02:00 and one PV in vg0 shows as unknown. The LV is still serving reads. What do you do first?

Passing score: 75%. Answers are checked in this browser.