Recover deleted LVM partitions in Linux LVM CentOS/Ubuntu/Debian/Fedora

It is very common when working with logical volumes and you so happen to delete one. Lucky for us good Administrators, there is a way to recover the lvm. You can use teh command 'vgcfgrestore'.

 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 your Volume Group
 
# vgcfgrestore --list < Volume-Group-Name >
# vgcfgrestore --list my-vg


LVM  Centos PS


In the above example the correct configuration are backed up , in my case “my-vg_00002-692643462.vg” is correct file through which I will recover my lvm partitions.
Also notice the Description. If the lvmremove command was the last executed command then you stand a chance.

Step 2: Recover the LVM Partition using the command vgcfgrestore and the archinve file.

 
# vgcfgrestore -f /etc/lvm/archive/

To find out your volume group name, use the command vgs

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


The output should read "Restored volume group"

Step 3: Make the recovered LVM active.
You must make the recovered partition active. Do this with the following command.

# lvchange -a y /dev/vg_VolumeGroupName/lv_logicalVolumeName

That should be all that is required to recover a deleted Logical Volume.
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

Cheapest Linux VPS Hosting in the world!

Access the best web hosting vps to enhance the efficiencyWeb hosting is an obligatory service if...

Virtual Hosting with Apache Linux Server

How to Setup Multiple Hosts on ApacheIt's the example to configure virtual hostings. Following...

Install MySQL for Database Server on CentOS VPS

 Install MySQL for Database Server. [root@www ~]# yum -y install mysql-server...

Add a HardDrive to Your Linux VPS

 This is an example to create a partition when you add a new hard drive. root@dlp:~#...

HowTo: Shrink size of ext4 LVM logical volume

HowTo: Shrink size of ext4 LVM logical volume LVM, the Logical Volume Manager, is...