recommendations on how to recover a corrupted, LVM-based hard drive?
Robert Nichols
rnicholsNOSPAM at comcast.net
Sat Feb 15 17:28:12 UTC 2014
On 02/15/2014 10:12 AM, Robert P. J. Day wrote:
> i would think it would be simpler than that -- here's the top part
> of the backup file:
>
> ===== start =====
> ... snip ...
> description = "Created *after* executing '/usr/sbin/pvscan --cache --activate ay /dev/block/8:21'"
>
> creation_host = "localhost.localdomain" # Linux localhost.localdomain 3.11.10-301.fc20.x86_64 #1 SMP Thu Dec 5 14:01:17 UTC 2013 x86_64
> creation_time = 1388764989 # Fri Jan 3 11:03:09 2014
>
> vg1 {
> id = "T8PpR6-Dh0C-3rpj-HRkh-6T9E-0r3f-YNZjVL"
> seqno = 7
> format = "lvm2" # informational
> status = ["RESIZEABLE", "READ", "WRITE"]
> flags = []
> extent_size = 8192 # 4 Megabytes
> max_lv = 0
> max_pv = 0
> metadata_copies = 0
>
> physical_volumes {
>
> pv0 {
> id = "Yc26dN-mfSd-sGGf-Q9KU-OutY-sJgM-4P74WB"
> device = "/dev/sdb5" # Hint only
>
> status = ["ALLOCATABLE"]
> flags = []
> dev_size = 1400690688 # 667.901 Gigabytes
> pe_start = 384
> pe_count = 170982 # 667.898 Gigabytes
> }
> }
> ===== snip rest of file =====
>
> because this disk represented pretty much a default fedora
> installation, i'm assuming that there is a first primary /boot
> partition, and the remainder of the 750G drive after that was
> formatted as a single physical volume (pv0), which was then assigned
> to the single volume group (vg1), which was then broken up into
> multiple LVs.
>
> and from the above snippet, it would seem that physical volume pv0
> started at pe_start * (4M) extent_size, or 384 * 4 = 1536M. would the
> math really be that straightforward? is the above telling me that the
> single PV on that drive used to start at, effectively, 1.5G?
No. That would be where the allocatable extents start _within_ the PV.
When I look at one of my VGs, a PV that is in /dev/sda10 (near the
end of the disk) shows that same "pe_start = 384". I'm not sure what the
units are, but the "Bad block HOWTO" at
http://smartmontools.sourceforge.net/badblockhowto.html
contains this snippet:
"The physical partition used by LVM2 is divided in PE (Physical
Extent) units of the same size, starting at pe_start' 512 bytes
blocks from the beginning of the physical partition."
Indeed, if I run "losetup -f --show -o $((384*512)) /dev/sda10", then
"file -s /dev/loop0" finds an ext2 filesystem there.
> note: remember that the MBR was trashed as well -- it contains info
> about an alleged 2G bootable image. if i *know* the offset of the
> (damaged) physical volume, i guess i can always go into fdisk and
> simply adjust the MBR to define a "Linux LVM" partition at precisely
> that offset so i have at least a special device file that now
> (theoretically) corresponds to the original PV. does that make sense?
Yes, exactly. The trick is knowing where the PV starts, and you don't
know that yet.
--
Bob Nichols "NOSPAM" is really part of my email address.
Do NOT delete it.
More information about the users
mailing list