Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Ubuntu This forum is for the discussion of Ubuntu Linux.


  Search this Thread
Old 06-20-2009, 02:51 PM   #1
LQ Newbie
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
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?
Old 06-21-2009, 01:02 PM   #2
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 124Reputation: 124
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I LVM2 defrag or move based on logical volumes MikeyCarter Linux - Software 2 12-09-2008 02:06 PM
Using testdisk to recover a partition Mark_in_Hollywood Linux - Newbie 6 04-18-2008 08:54 PM
Using testdisk to recover deleted lvm2 partition sstendal Linux - General 2 04-02-2008 10:30 AM
how to fix when testdisk cant recover ext2/ext3? frenchn00b Linux - Newbie 3 07-19-2007 05:46 PM
I did not know about logical volumes gezi Linux - Newbie 5 04-27-2005 10:26 AM > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 08:54 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration