While working on Linux production boxes, sometimes system admin mistakenly deletes LVM partitions. Using the command ‘vgcfgrestore’ we can recover deleted LVM partitions. Linux keeps the backup copies of lvm configuration in the/etc/lvm/archive directory. In my scenario I have deleted 10GB lvm partition, follow the below steps to recover the LVM partition:

Step 1: Find the backed up configurations of volume group (my-vg).

Syntax:

# vgcfgrestore --list [Volume-Group-Name]

For example:

# vgcfgrestore --list my-vg

Recover deleted LVM partitions in CentOS/RHEL/Fedora

As you can see in the above example correct configurations are backed up, in my case, “my-vg_00002-692643462.vg” is the correct file through which I will recover my lvm partitions.

Step 2: Now recover the LVM partition using the vgcfgrestore and archive file.

Syntax:

# vgcfgrestore -f /etc/lvm/archive/[file-name] [Voulme-Group-Name]

For example:

# vgcfgrestore -f /etc/lvm/archive/my-vg_00002-692643462.vg  my-vg

Output would be:

'Restored volume group my-vg'

Now we can mount the lvm partition and check whether the data is there or not.