You are not logged in.

#1 2012-10-04 00:18:35

m1ck3y
Member
Registered: 2012-09-28
Posts: 6

[SOLVED]Recovering an lvm volume group

Hi,
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)

Offline

#2 2012-10-04 04:29:33

hunterthomson
Member
Registered: 2008-06-22
Posts: 794
Website

Re: [SOLVED]Recovering an lvm volume group

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)


OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec

Offline

#3 2012-10-04 05:36:51

djgera
Developer
From: Buenos Aires - Argentina
Registered: 2008-12-24
Posts: 708
Website

Re: [SOLVED]Recovering an lvm volume group

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 wink

Offline

#4 2012-10-04 21:29:10

m1ck3y
Member
Registered: 2012-09-28
Posts: 6

Re: [SOLVED]Recovering an lvm volume group

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)

Offline

Board footer

Powered by FluxBB