Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


Search this Thread
Old 04-04-2003, 07:46 PM   #1
LQ Newbie
Registered: Apr 2003
Posts: 1

Rep: Reputation: 0
Hard drive recovery, LVM

I accidentally added a hard drive to an LV array before moving the data off of it. Is there any way to recover this data? I looked at changing the filesystem type back to 83 in fdisk, but I didn't do it for fear of further damaging things. Any ideas?
Old 04-08-2003, 01:07 PM   #2
Registered: Aug 2001
Location: Dublin, Ireland
Distribution: Slackware
Posts: 5,700

Rep: Reputation: 57
If it was synced with the array it probably got formatted, if its simple linear append mode, its probably fine... I never use LVM so I'm not certain, but if it didn't do a sync like a raid array it's probably all there minus the superblock. There are copies of the superblock at different inodes throughout the disk, but I'll be buggered if I remember how to retrieve them... also, I have just repartitioned a disk without formatting and found gobs of my old data on there, but I went from 83 to 83...


Old 07-10-2004, 11:49 AM   #3
LQ Newbie
Registered: Oct 2002
Posts: 15

Rep: Reputation: 0
First corrupt partician tables,then lvm control data lost (some progress)

Well, I've slowly been coming to grips with recovering with what to me is a pretty serious hard disk calamity.

I rebooted my Linux system, as it was up and running for 48 days or so, and it just seemed to be time to do it. When the system came back up, many of the hard disk partician tables were lost, and it wouldn't boot.

After much research on the Internet, I found that a partician table could be re-written and all the data in the file system maintained. I also found a tool, TestDisk at by Christophe GRENIER <>, which seemed to do a good job of sniffing out partician tables from the remaining file system data. Well, it did OK on the system disk, found the first FAT partician and the ext3 partician for the root of the system. In fact, after it wrote out the partician table, I could mount the root file system without any sort of fsck required. Very cool.

Of the LVM hard disks, which is why I'm submitting this post, 3 out of 4 partician tables were identified and recovered (/dev/hde1, /dev/hdg1, /dev/hdh1 but not /dev/hdf1). For Lvm, I always used a single primary partician, non-bootable, which uses the entire space on the hard disk. So recovering this partician table should be no problem, right? I used fdisk and re-created the partician table.

OK, so I've not re-written the grub boot-loader on the system disk, but I did boot off of a rescue CD and performed a chroot to where the root file system was mounted, so I have a chrooted environment, and I can run access the binaries and file from the old system hard disk. I check to make sure that the lvm module was loaded using lsmod, and it was so, now I figured I'd see how far I could get to recover the 130 GB of data that was on the LVM volume.

First things first, I tried vgscan, and got the following results:

vgscan -- reading all physical volumes (this may take a while...)
vgscan -- ERROR "vg_read_with_pv_and_lv(): current PV" can't get data of volume group "u00_vg" from physical volume(s)
vgscan -- "/etc/lvmtab" and "/etc/lvmtab.d" successfully created
vgscan -- WARNING: This program does not do a VGDA backup of your volume group

Additionally, pvscan reports the following:
pvscan -- reading all physical volumes (this may take a while...)
pvscan -- inactive PV "/dev/hdg1" is associated to unknown VG "u00_vg" (run vgscan)
pvscan -- inactive PV "/dev/hdh1" is associated to unknown VG "u00_vg" (run vgscan)
pvscan -- inactive PV "/dev/hde1" is associated to unknown VG "u00_vg" (run vgscan)
pvscan -- total: 3 [204.96 GB] / in use: 3 [204.96 GB] / in no VG: 0 [0]

I did a pvdata, and produced the output at the bottom part of this message. First notice that all the drive letters are the same, which I think is a good thing. I also notice that way at the end, there are UUIDs for each of the volumes. Now it would appear that the UUID from the one bad volume is lost. Do you suppose that I could use the UUID_fixed program to put that UUID back on the physical volume and get it back?

Next, I moved the LVM disks from the old RedHat machine where they started off at over to a SuSE 9.0 machine for the purpose of recovering any data that I can. The main reason is that the SuSE machine has a DM patched kernel and LVM2, which should be able to handle partial LVMs. I've also added a brand new 200 GB hard disk to copy the recovered data to. While it won't hold uncompressed images of the LVM disks, if I recall, I had something like 68 GB free on the LVM set, so I should have enough room to hold all the recovered data.

I tried using e2retrieve (at to copy off the data by analyzing the raw disk data, but after it scans all the disks, it seg faults. So that went nowhere. Too bad, from the description of the program, it has some real promise for a general LVM recovery utility.

When I do a pvscan, I get this (this is now with LVM2):
3 PV(s) found for VG u00_vg: expected 4
Logical volume (u00_lv) contains an incomplete mapping table.
PV /dev/hde1 is in exported VG u00_vg [55.89 GB / 0 free]
PV /dev/hdg1 is in exported VG u00_vg [74.52 GB / 0 free]
PV /dev/hdh1 is in exported VG u00_vg [74.52 GB / 0 free]
Total: 3 [0 ] / in use: 3 [0 ] / in no VG: 0 [0 ]

When I go a vgscan, I get this:
Reading all physical volumes. This may take a while...
3 PV(s) found for VG u00_vg: expected 4
Volume group "u00_vg" not found

Also, I'm wondering how I can re-create the volume group and logical volumes to that I can mount the file system in read only more and copy all the data off that I can access without causing any greater data loss on the hard disks.

Any help in answering these questions would be greatly appreciated, as I know what to do when LVM is working, but I'm at a little of a loss when it's not working.

Thanks in advance,

pvdata information:

--- Physical volume ---
PV Name /dev/hde1
VG Name u00_vg
PV Size 55.90 GB [117226242 secs] / NOT usable 4.18 MB [LVM: 179 KB]
PV# 1
PV Status available
Allocatable yes (but full)
Cur LV 1
PE Size (KByte) 4096
Total PE 14308
Free PE 0
Allocated PE 14308

--- Physical volume ---
pcdata /dev/hdf1
pvdata segfaults on this command.

--- Physical volume ---
PV Name /dev/hdg1
VG Name u00_vg
PV Size 74.53 GB [156296322 secs] / NOT usable 4.25 MB [LVM: 198 KB]
PV# 2
PV Status available
Allocatable yes (but full)
Cur LV 1
PE Size (KByte) 4096
Total PE 19078
Free PE 0
Allocated PE 19078
PV UUID AZf9pT-TYsE-Y3xF-jolh-Z9EF-WV3l-T6yATO

--- Physical volume ---
PV Name /dev/hdh1
VG Name u00_vg
PV Size 74.53 GB [156301425 secs] / NOT usable 4.25 MB [LVM: 198 KB]
PV# 6
PV Status available
Allocatable yes (but full)
Cur LV 1
PE Size (KByte) 4096
Total PE 19078
Free PE 0
Allocated PE 19078
PV UUID 8seUMF-A73a-V5tQ-N88Q-Uv0M-Ci6f-5wVO9C

--- Volume group ---
VG Name
VG Access read/write
VG Status NOT available/resizable
VG # 0
MAX LV 255
Cur LV 1
Open LV 0
MAX LV Size 255.99 GB
Max PV 255
Cur PV 4
Act PV 4
VG Size 243.28 GB
PE Size 4 MB
Total PE 62279
Alloc PE / Size 62279 / 243.28 GB
Free PE / Size 0 / 0
VG UUID tUQf5q-QvaA-hEj8-slM0-MmoW-A2Xt-47HS1p

--- List of physical volume UUIDs ---

001: AZf9pT-TYsE-Y3xF-jolh-Z9EF-WV3l-T6yATO (/dev/hdg1)
002: Pclazx-RnTY-QBCG-P1O6-dVDg-V435-SlLluH (/dev/hdf1?)
003: 8seUMF-A73a-V5tQ-N88Q-Uv0M-Ci6f-5wVO9C (/dev/hdh1)
004: VILh9i-uWlA-cKBM-AcRJ-VYU7-54kM-OgiWQm (/dev/hde1)
Old 12-30-2004, 09:47 PM   #4
Registered: Jun 2003
Distribution: Arch
Posts: 315

Rep: Reputation: 30
My "maps" of drives seem to have been erased. Is there any way to rebuild them? I know there is data there, but lvm doesn't think so.


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
Hard drive recovery? goemon Linux - Hardware 4 11-20-2005 08:30 PM
LVM Recovery enabler Linux - Newbie 8 02-23-2005 02:09 PM
using LVM for single hard drive csfalcon Linux - Hardware 2 02-17-2005 11:17 AM
Oh no!! LVM broke, need help with recovery. kleptophobiac Linux - General 5 12-31-2004 11:22 PM
Linux Hard Drive Recovery Procedure. DarkestHour Linux - Software 3 11-27-2004 09:20 PM

All times are GMT -5. The time now is 06:44 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 @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration