recommendations on how to recover a corrupted, LVM-based hard drive?

Robert Nichols rnicholsNOSPAM at comcast.net
Sat Feb 15 15:20:43 UTC 2014


On 02/14/2014 08:52 AM, Robert P. J. Day wrote:
>    so ... what now? i can see the detailed definition of the volume
> group, and all of the logical volumes that were/are(?) still there,
> and the only LV i care about is "home" which is the fifth one down in
> the list of LVs, suggesting it's far enough down to have escaped the
> overwriting unscathed.
>
>    so what would be the proper recipe to simply reactivate that volume
> group and single logical volume within that group? thanks.

You need to figure out just where that PV partition was located on
the disk.

In the physical_volumes section, look at the dev_size. How might
that have been placed on the disk? It was very likely a partition
that went to the end of the disk -- perhaps not the very end but
just the last full "cylinder" (at the most common geometry of 255
heads and 63 sectors per track). From that, calculate the starting
location for the partition. Keep playing until you get something
"reasonable", i.e., either a cylinder boundary or a megabyte
boundary (LBA a multiple of 8).

Now look at the start_extent for that fifth LV.  Multiply by the
extent size (it'a at the top, in the global parameters) and then
calculate its LBA based on the presumed starting LBA for the PV
partition. See if that corresponds to one of the partition
candidates found by testdisk.  If you can find a match, create the
PV partition, initialize it with pvcreate and the same UUID the PV
originally had, and then do a vgcfgrestore from the file you've been
using.

If this were a real recovery situation, you would of course be doing
all this from a copy of the drive, not the original. But you've said
elsewhere that this is an intellectual exercise and you have a
backup of the data, so there's no serious harm done if something
goes terribly wrong.

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.



More information about the users mailing list