[linux-lvm] Re: Recovering PV and LG after fdisk or Repartition

Adam Tybor adam.tybor at gmail.com
Thu Jan 4 11:18:48 UTC 2007


> I made a huge mistake last night.  I was repartitioning drives in my
> system using fdisk.  I accidentally fdisk the wrong drive, rebooted,
> and lost my lvm2.  In light of this error, I did a dd from the
> original disk to another disk of the exact same geometry before I
> started trying to recover the original.


Just an update, after quotes upwards of $5,000 I decided to call in my
own big guns.  I had one of my friends come over and take a peek.
Within 2 hours he put me in a process to fix the data.

Turns out that metadata which should have resided on sdc1 was actually
at sdc.  This was found after several dd dumps and hexdiffs and the
like.  We were comparing the corrupted disk to good disks which is how
we found the problem.

Lets just say that vgscan
-dvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv provides some very
detailed info which led him in the right direction.

We added new disk, sdb, partitioned it like the previous disk. Then
moved some bits.

dd if=/dev/sdc bs=512 count=6000 of=/dev/sdb1

Upon doing this vgscan found the volume group metadata, but could not
load the vg.  On a side note, using a bs higher than 512 did not work.

Inspecting the logs vgscan found the label at sector 1 but expected it
at sector 2.  Simply adding skip=1 to the dd above did the trick.  The
volume group came up, reiserfs was in shambles, only 3MB of its 100GB
were there, but it was progress :)

Running a final dd of the 130GB of the previous lvm group did the trick.

I am currently copying files off the drive onto another one.  Reiserfs
complains about a couple things, I will need to run a --rebuild-tree
to get at some data, I just want this stuff off of here as soon as
possible.

Cheers,
Adam




More information about the linux-lvm mailing list