I am on CentOS 5.5 and am running Xen. I have a large volume group that I create logical volumes on using lvcreate. Today I had a customer cancel her account, then change her mind about an hour later. Unfortunately I had already removed the LVM her Xen image resided on. (just using a standard lvremove ). There has been no other LVM activity on this disk since then (nothing else added or deleted). Is it possible to "undo" a lvremove, or recover logical volume? If so, how would I go about it?
LVM does backup it's metadata to
The following can be dangerous and destructive so be very careful and if possible have a full backup.
The command to restore these volumegroup metadata backups is
" Could you please be more specific abut finding EFROM and ETO from the backup file? All the lv have a "start_extend" from 0 in my backup file so I'm a bit lost :) Thanks! – user186975 Aug 24 '13 at 17:06 "
Ok, I will be very specific...with the Most simple way to recover a logical volume.
1 - I have removed my logical volume!
2 - First thing to do is, look for the archive file at /etc/lvm/archive/vg1_(xxxxx).vg. I can do that, just looking the date that i have removed the logical volume!
3- I found it!
Date where i did the lvremove!!!...it was a minutes ago..
4 - Let's see the file!
5 - Make a test before recover it!
6 - Ok, now repeat the command line, without the (--test)
7 - Check it!
8 - If the logical was not active, do it!
I hope this can help other people who are looking for this solution!
The easiest thing to recover from lvremove (assuming you didn't write to the extents the LV was residing in) is:
Just find the backup of your metadata in /etc/lvm/archive and figure out
a) which extents the LV was residing in (EFROM, ETO)
After you have this info you create a new LV of the exactly same size on the exactly same PV extends without wiping the first 8kB of the LV: