LVM

Matt Graham danceswithcrows at usa.net
Wed Apr 16 14:04:58 MST 2008


After a long battle with technology, Shawn Badger wrote:
> I don't have this issue with anything critical,

Why do people call problems "issues"?  (I've asked this in multiple places for 
years now, and never gotten a coherent answer.)

> but I know the time is coming. I know how to [recover LVs] when I have the
> original system, but I would like to find a reliable way when someone brings
> me a drive from a dead system and wants to pull data off of it.

The problem is very badly specified.  If the PV is damaged in some way 
(creeping bad sectors, head crash, whatever) then all bets are off.  If the 
PV was part of a multiple-PV VG, then it's a crapshoot as to whether you can 
recover individual LVs for obvious reasons.  If the PV was the only PV in a 
VG, then it becomes easier.

So:  I created a PV on a test disk, made a VG called "testvg" on it, made an 
LV called "testlv" on that VG, mke2fs'ed, mounted, and copied a bunch of data 
over.  I then umounted the LV and did vgchange -a n testvg.  Then, I 
unplugged the disk and connected that disk to another machine that had never 
had any PVs connected to it.  I then ran pvscan followed by vgchange -a y, 
and lvm2 found the VG and LV.  I mounted the LV on this machine and ran 
md5sum on everything, finding no differences from the originals in anything.

This little example shows me that moving PVs between systems can work.  It's a 
bit contrived though.  In the real world, you'd probably have to insert a 
vgrename in there before the vgchange -a y, since too many distros call their 
VGs "vg00" or something unimaginative like that.  Also, the disk I used had 
no data corruption and was deactivated before being unplugged.  The man pages 
indicate that if the PV (not the VG, not necessarily) is corrupt, re-running 
pvcreate on the partition may salvage it.  If the LV structures get 
corrupted, I don't know what the heck you'd do.  Anyway, HTH,

-- 
   That which does not kill us makes us stranger.
   --Trevor Goodchild, Aeon Flux
  My blog and resume: http://crow202.dyndns.org:8080/wordpress/
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see


More information about the PLUG-discuss mailing list