[CentOS] HowTo Recover Lost Data from LVM RAID1 ?

Fri Jan 18 21:31:26 UTC 2008
Timothy Selivanow <timothy.selivanow at virtualxistenz.com>

On Fri, 2008-01-18 at 15:47 -0500, Alain Reguera Delgado wrote:
> Guys,
> 
> The other day while working on my old workstation it got frozen and
> after reboot I lost almost all data unexpectedly.
> 
> I have a RAID1 configuration with LVM. 2 IDE HDDs.
> 
> md0 .. store /boot (100MB)
> --------------------------
> /dev/hda2
> /dev/hdd1
> 
> md1 .. store / (26GB)
> --------------------------
> /dev/hda3
> /dev/hdd2
> 
> The only info that still rest in was that, that I restore after the
> fresh install. It seems that the disk were with problems and weren't
> syncing :(. I confessed, I didn't check that at first time but after I
> lost the data and check /var/log/messages I saw that.
> 
> >From /var/log/messages
> ...
> Jan 17 12:22:15 zion kernel: md: raid1 personality registered for level 1
> Jan 17 12:22:15 zion kernel: device-mapper: ioctl: 4.11.0-ioctl
> (2006-09-14) initialised: dm-devel at redhat.com
> Jan 17 12:22:15 zion kernel: md: Autodetecting RAID arrays.
> Jan 17 12:22:15 zion kernel: md: invalid raid superblock magic on hda3
> Jan 17 12:22:15 zion kernel: md: hda3 has invalid sb, not importing!
> Jan 17 12:22:15 zion kernel: md: autorun ...
> Jan 17 12:22:15 zion kernel: md: considering hdd2 ...
> Jan 17 12:22:15 zion kernel: md:  adding hdd2 ...
> Jan 17 12:22:15 zion kernel: md: hdd1 has different UUID to hdd2
> Jan 17 12:22:15 zion kernel: md: hda2 has different UUID to hdd2
> Jan 17 12:22:15 zion kernel: md: created md1
> Jan 17 12:22:15 zion kernel: md: bind<hdd2>
> Jan 17 12:22:15 zion kernel: md: running: <hdd2>
> Jan 17 12:22:15 zion mcstransd: mcstransd starting
> Jan 17 12:22:15 zion kernel: raid1: raid set md1 active with 1 out of 2 mirrors
> Jan 17 12:22:15 zion kernel: md: considering hdd1 ...
> Jan 17 12:22:15 zion kernel: md:  adding hdd1 ...
> Jan 17 12:22:15 zion kernel: md:  adding hda2 ...
> Jan 17 12:22:15 zion kernel: md: created md0
> Jan 17 12:22:15 zion kernel: md: bind<hda2>
> Jan 17 12:22:15 zion kernel: md: bind<hdd1>
> Jan 17 12:22:15 zion kernel: md: running: <hdd1><hda2>
> Jan 17 12:22:15 zion kernel: md: kicking non-fresh hdd1 from array!
> Jan 17 12:22:15 zion kernel: md: unbind<hdd1>
> Jan 17 12:22:15 zion kernel: md: export_rdev(hdd1)
> Jan 17 12:22:15 zion kernel: raid1: raid set md0 active with 1 out of 2 mirrors
> Jan 17 12:22:15 zion kernel: md: ... autorun DONE.
> ...
> 
> This computer is old, Celeron 800MHz, 256MB of RAM and IDE disk too.
> 
> I know that I have to suffer the consequences but if you know some way
> to recover some data, I'll appreciate it very much.
> 
> These days I have been reading about: mdamd, and some way to recover
> but no success.
> 
> I tried to boot from rescue mode with CentOS 5 first CD and do an fsck
> to /dev/hda3 and /dev/hdd2. After this something about superblock was
> told to me and that use the command e2fsck -b 8123 <device> (I don't
> remember the number exactly) but no success either.
> 
> Do you have some idea what we can do to recover the data on m1 ?
> 
> Thanks guys,
> 
> Cheers,
> al.

When you booted to rescue mode on the CD, did you let it find your
existing CentOS install and mount it (I can't remember if it will
continue in degraded mode ATM)?  You should also be able to see the data
with just one drive IIRC, you just need to be able to map the LVM
volumes.  Except for the MD meta-data, the bits should be 1-for-1 across
the disks AFAIK.

Check out http://tldp.org/HOWTO/LVM-HOWTO/ for more info about LVM.


--Tim
 ________________________________________________________________________ 
< PEGGY FLEMMING is stealing BASKET BALLS to feed the babies in VERMONT. >
 ------------------------------------------------------------------------ 
  \
   \   \
        \ /\
        ( )
      .( o ).