Tuesday, December 8, 2015

How to restore a deleted volume group ?

Issue:

1. Unable to find the volume group, even though all devices are present.
2. LVM metadata has been deleted.


Solution:

Always there is a backup of metadata before and after running any LVM on a PV/VG/LV. which is allways taken by LVM.

Backup location is /etc/lvm/archive/ (the copies taken before executing a command) and in /etc/lvm/backup (copies taken after executing a command).
Also you can find the backup file using vgcfgrestore command.
 
# vgcfgrestore --list   <Volume-Group-Name>

# vgcfgrestore --list geo-vg

Ouput:

# data-vg_00_00000-16736.vg

Using the vgcfgrestore command metadata can be written back to the devices belonging to that volume Group which found from backup.

# vgcfgrestore -f /etc/lvm/archive/<file-name> <Voulme-Group-Name>

Example:

# vgcfgrestore -f /etc/lvm/archive/geo-vg_00_00000-16736.vg  geo-vg

Output:

# Restored volume group geo-vg

No comments:

Post a Comment