-   Ubuntu (
-   -   proper way to use testdisk to recover missing logical volumes on a raid 5 w/ LVM2 (

markley268 06-20-2009 01:51 PM

proper way to use testdisk to recover missing logical volumes on a raid 5 w/ LVM2
so i have 4 disks in a raid 5, /dev/sd[abcd]2......they were being recogized as /dev/md0 and i wanted them to be recognized as /dev/md2 to co-inside with the /dev/sd[abcd] in a recovery mode from the ubuntu 9.04 server install cd, i removed /dev/md0 and created /dev/md2 as a raid 5 with 4 active disks....

But then my volume group (only had one, vg_system) was missing, and correspondingly all my logical volumes (lv_slash, lv_usr, lv_home, lv_tmp, lv_var, lv_opt)

I remember specifically that i had created lv_slash first, and w/ -L30G, so i re-created the pv and volume group (vg_system), and then added a 30G lv called lv_slash.....

So now i want to run testdisk to put the ext3 partition that was in lv_slash back so i can read the data, and provided that works, eventually figure out and recover the other 5 LVs on that volume group.

So my question is, what's the best way to run testdisk to recover these logical volumes? When i ran 'sudo testdisk /dev/mapper/vg_system-lv_slash' i was able to see the 30G partition, and could list the files that were there, but when i try and mount/fsck the LV, fsck complains about having a bad superblock and a non recognizable ext2 (which it's not, it's an ext3) superblock. It's almost like even though i'm running fsck.ext3, it's really running e2fsck for ext2 only....

ok, so i use testdisk to look for other superblocks, and write down all the block #'s, (4096 block size) and still no good w/ fsck.ext3, it complains about every single one of the -b <block> -B 4096 options i give it.

Should the disk geometry for testdisk when scanning LVs be something specific? I believe my CHS is <some huge number>,1,1

any ideas?

Matir 06-21-2009 12:02 PM

For one, I'm not sure why you decided to recreate things manually -- there's a chance you over-wrote data on the disk when you did that. I haven't tried it with LVM, but normally with testdisk I'll let it handle the restoration of the filesystems. Go in and tell testdisk to restore the volumes.

Disk geometry is irrelevant once you're using the Linux MD layer.

Of course, the easiest way is probably just to restore from backups.

All times are GMT -5. The time now is 09:50 PM.