Skip to contentSkip to conversation

Recovering Data From LVM

linux-lvm [email protected] 2 participants 2 messages Sep 17, 2005

lore
Share & tools
lore
#0 lore raw

I've done some googling all night and I haven't found anything that can help me with my current dilemma. :-( I have a HDD that was imaged with Fedora Core 3, and there is some data on there that I want to recover. The data is on an LVM, which occupied just the one drive (it never spanned multiple disks).

The problem is that there does not appear to be any logical volumes in the volume group. This was the original layout of the disks:

/dev/hda1 ext3 102MB 1 13
/dev/hda2 lvm 39104MB 14 4998

VolGroup00 Size 39040
LogVol00 / ext3 38272
LogVol01 swap 768

I am working from a computer with Fedora Core 4 now, and this old hard drive is mounted as a slave (/dev/hdb). I have tried the following:

# pvscan
  PV /dev/hda2   VG VolGroup00   lvm2 [37.16 GB / 32.00 MB free]
  PV /dev/hdb2                   lvm2 [38.18 GB]
  Total: 2 [75.33 GB] / in use: 1 [37.16 GB] / in no VG: 1 [38.18 GB]

There is no name for me to vgimport. And if I install the drive as a master to this computer, to try and boot from it and transfer the data out, it informs me that it can't find VolGroup00 and refuses to boot.

If I take that HDD to a Windows machine and mount it as a slave, explore2fs reads /dev/hdb1 which is just an ext3 partition, but doesn't see the LVM at all.

I suspect that I corrupted the structure of the LVM when I was trying to mount it originally. At one point I had run "vgcreate oldhdd /dev/hb2" or something to that effect. None of the processes took more than a second, so I strongly believe that the data itself is still there.

Any help would be greatly appreciated!

Best regards,

Michael.

#1 lore raw
Quoted 6 lines · On Sat, 2005-09-17 at 08:51 -0500, [email protected] wrote:

The problem is that there does not appear to be any logical volumes in the volume group. This was the original layout of the disks:

/dev/hda1 ext3 102MB 1 13
/dev/hda2 lvm 39104MB 14 4998

Quoted 8 lines

VolGroup00 Size 39040
LogVol00 / ext3 38272
LogVol01 swap 768
...
I suspect that I corrupted the structure of the LVM when I was trying to mount it originally. At one point I had run "vgcreate oldhdd /dev/hb2" or something to that effect. None of the processes took more than a second, so I strongly believe that the data itself is still there.

Looks like you need to restore the original metadata to the drive, from before you accidentally modified it. You'll find a history of metadata backups in /etc/lvm/archives. Pick the last one that looks good (read them, they're text files) and use vgcfgrestore to write it back to the drive.

Then "vgchange -ay" should find the volume group and make all the logical volumes active.

Cheers,

Martin.