Today I deleted volume group from encypted lvm. Please help to recover! I opened it with "cryptsetup luksOpen /dev/sda2 lvm" then by mistake I typed "lvm pvcreate -ff /dev/mapper/lvm". Is it possible to recover volume group?
Last edited by m1ck3y (2012-10-04 21:32:32)
Hum, I bet there is a way.
One thing I can say is that with lvm on an encrypted device. The encrypted part should not effect anything. Once you decrypt the device with cryptsetup luksOpen. The device it is mapped to in /dev/mapper/ is just seen as a normal plain text block device to the system.
So, you can narrow your googling to simply recovering a deleted LVM Volume Group.
Here is one link I have found. I'll keep looking becuase I'd like to know how to do this too.
Recovering Logical Volumes deleted with lvremove
http://new.spheron1.co.uk/2011/03/20/re … -lvremove/
... Owe, hum did you delete the Volume Group? or it looks like you deleted the Physical Volume...
Okay, recovering LVM Physical Volumes seems doable aswell. Here is the first google link, but many more are avalable to look at.
Recovering an LVM Physical Volume
http://www.barryodonovan.com/index.php/ … m-recovery
Last edited by hunterthomson (2012-10-04 04:40:00)
Before touching anything on such device, I suggest to do and snapshot to work on it. I that way your original device is untouched, and all changes are made on a new device via a backing file.
To do this:
truncate -s 512M /tmp/snap-cow echo "0 $(blockdev --getsz /dev/mapper/lvm) snapshot /dev/mapper/lvm $(losetup --find --show /tmp/snap-cow) N 8" | dmsetup create my-snapshot
Now you can safe work without any danger in /dev/mapper/my-snapshot. Depending of how much need to be wrote, you may need to increse the size of "/tmp/snap-cow"
truncate -s +xxxM /tmp/snap-cow
To remove such device:
dmsetup remove my-snapshot
If all thing goes good, you can replay all actions, but working directly on the real device
Thanks for the reply. I have copied my work files from deleted volumes with testdisk utility and installed new system.
Last edited by m1ck3y (2012-10-04 21:31:48)