How to restore/recover a deleted volume group in LVM CentOS / RHEL?

LVM takes a backup of the on-disk metadata before and after running any LVM operation on a PV/VG/LV. For example, if you create a new LV the backup of all the metadata for the VG before and after creating the new LV is backed up. These backups are stored in

 

1. /etc/lvm/archive: contains copies taken before executing a command.

2. /etc/lvm/backup: contains copies taken after executing a command.

 

Listing available backups

 

The backup files can also be found using the vgcfgrestore command. The command lists all the available backups of metadata before any LVM operations.

# vgcfgrestore --list   [VG_name]

 

# vgcfgrestore --list appvg
# appvg_00_00000-123456.vg

 

Restoring the metadata

 

Once the correct backup file has been found, the metadata contained in it can be written back to the devices belonging to that Volume Group using the vgcfgrestore command:

# vgcfgrestore -f /etc/lvm/archive/[backup_file] [VG_name]

 

For Example: 

# vgcfgrestore -f /etc/lvm/archive/appvg_00_00000-123456.vg  appvg
# Restored volume group appvg

 

You should now be able to see appvg using the vgs command.

 

Note: This procedure will only restore the LVM metadata, making the Volume Group visible again. If actual data has been deleted from the disk, that will have to be restored using different methods (backup, etc.).

Once the Volume Group has been restored, a manual check for the actual on-disk data should be run. The procedure is only to restore the metadata of the Volume group. So there is no substitute for the actual data backup, in case if some one deletes that too.

 

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