Updated: 28 September 2026 · Applies to: LVM 2.03 on AlmaLinux and Rocky Linux 9 and 10, RHEL 9 and 10, Ubuntu 24.04 and 26.04, Debian 13

If a volume group was removed by mistake with vgremove, the data is usually still on the disks: LVM only deleted its description of the volumes. Before every change, LVM saves a copy of that description in /etc/lvm/archive/, and you can restore it. We tested this on AlmaLinux 9 with LVM 2.03.33: after vgremove, and again after vgremove plus pvremove, the volume group, its logical volume and the XFS file system on it came back and mounted normally.

Before you start

  • Do not write anything else to the disks: no new volume group, no mkfs, and no pvcreate except the recovery command shown at the end.
  • The steps work when the physical volumes still exist (pvs lists them, possibly without a group). If they were also removed with pvremove, see the last section.

Steps

  1. List the saved versions of the volume group:
    vgcfgrestore --list vgdata
    Each entry shows a file and a description such as Created *before* executing 'vgremove vgdata'.
  2. Choose the file created before the vgremove (not an older one: that might not contain volumes created later). You can check its contents with grep -E 'description|creation_time' FILE.
  3. Restore it:
    vgcfgrestore -f /etc/lvm/archive/vgdata_00012-123456789.vg vgdata
    It should answer "Restored volume group vgdata".
  4. Activate the volume group and check the volumes:
    vgchange -ay vgdata
    lvs vgdata
  5. Check the file system before mounting, then mount it:
    xfs_repair -n /dev/vgdata/data      # XFS: check only
    e2fsck -n /dev/vgdata/data          # ext4: check only
    mount /dev/vgdata/data /data

If the physical volume was removed too

After pvremove, recreate the PV with its old ID, taken from the archive file, and then restore the group:

grep -A3 'pv0 {' /etc/lvm/archive/vgdata_00012-123456789.vg      # shows id = "..." and the device
pvcreate --uuid "OLD-PV-UUID" --restorefile /etc/lvm/archive/vgdata_00012-123456789.vg /dev/sdc
vgcfgrestore -f /etc/lvm/archive/vgdata_00012-123456789.vg vgdata

Use the exact device and ID from the file. A wrong disk here destroys data.

Prevention

  • Keep a copy of /etc/lvm/archive/ and /etc/lvm/backup/ in your server backups.
  • Save the current layout before risky work: vgcfgbackup.

Official documentation: vgcfgrestore manual page and pvcreate manual page.

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)