LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-19-2007, 03:38 AM   #1
JohnJohnsonIII
LQ Newbie
 
Registered: Jan 2007
Posts: 6

Rep: Reputation: 0
LVM Hard Disk Recovery


I have done a lot of searching through the boards to find my issue, and although I have found similar cases, nothing has been quite what I needed. My problem is thus:
I had an old 1GHZ Athlon system running FC3. While I was away a capacitor on the motherboard blew and my site went down. I need to recover files from the hard disk. Needless to say, when the MB blew, the hard disk went down without grace. The disk is a 2GB disk partitioned as a linux partition and a Linux LVM partition. My first instinct was to try to mount the system as another drive, but was not very successful. Some people have suggested I try hooking it up on another system as the primary drive, but it ends up in a kernel panic and punts.
I decided to follow advice I have seen on mounting the drive as on another system(as an external USB drive) and trying to copy off the data. One concern that I have is that I can't make a GHOST of the disk because of inconsistency errors. I can't afford to screw up the drive any worse.
Before hooking it up, I checked the physical volumes with pvscan
and got the following:
---------------------

[root at www jsj]# /usr/sbin/pvscan

PV /dev/hde2 VG VolGroup00 lvm2 [38.06 GB / 32.00 MB free]

Total: 1 [38.06 GB] / in use: 1 [38.06 GB] / in no VG: 0 [0]

[root at www jsj]#

-----------------------

I hooked up the drive and turned it on and did another pvscan and got the following:

-----------------------

[root at www jsj]# /usr/sbin/pvscan

Couldn't find device with uuid '0caVRx-fuNp-lc2N-or5C-6Ky7-52oS-pQF0RU'.

PV unknown device VG VolGroup00 lvm2 [6.00 GB / 0 free]

PV /dev/sda2 VG VolGroup00 lvm2 [1.84 GB / 64.00 MB free]

Total: 2 [7.84 GB] / in use: 2 [7.84 GB] / in no VG: 0 [0 ]

-----------------------



I am worried about the "Couldn't find device with uid..." comment. My system went down hard and I am sure the drives need to be cleaned for inconsistencies(although I have no idea how to). Anyway, from this I can tell that the USB drive is on /dev/sda, so I decided to use fdisk to check out its partition table:
-----------------------

[root at www jsj]# /sbin/fdisk /dev/sda
Command (m for help): p
Disk /dev/sda: 2113 MB, 2113413120 bytes
255 heads, 63 sectors/track, 256 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 104391 83 Linux

/dev/sda2 14 256 1951897+ 8e Linux LVM
Command (m for help):
-----------------------

This looks right. Now how to mount it...it's a Linux LVM drive. I can directly mount /dev/sda1 but not /dev/sda2 since it is Linux LVM. I believe you are supposed to mount the volume group itself(hmm...would there be any trouble in that /dev/hde2 and /dev/sda2 are both automatically named VolGroup00?). I tried using vgchange:
-----------------------
[root at www jsj]# /usr/sbin/lvm vgchange -a y

2 logical volume(s) in volume group "VolGroup00" now active

-----------------------



So now we have two volumes active. It's time to see which volumes they
are...
-----------------------
[root at www jsj]# /usr/sbin/lvm lvscan

ACTIVE '/dev/VolGroup00/LogVol00' [37.53 GB] inherit

ACTIVE '/dev/VolGroup00/LogVol01' [512.00 MB] inherit

-----------------------

Hmm...neither seem to be my 2GB partition....not sure why...could it be
that the volumes on my other drive were named /dev/VolGroup00/LogVol00 and /dev/VolGroup00/LogVol00 as well? I'm not sure...I decided to take a look at the volume groups via the vgdisplay command...
-----------------------

[root at www jsj]# /usr/sbin/lvm vgdisplay -P -v

Partial mode. Incomplete volume groups will be activated read-only.

Finding all volume groups

Finding volume group "VolGroup00"

--- Volume group ---

VG Name VolGroup00

System ID

Format lvm2

Metadata Areas 1

Metadata Sequence No 3

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 2

Open LV 2

Max PV 0

Cur PV 1

Act PV 1

VG Size 38.06 GB

PE Size 32.00 MB

Total PE 1218

Alloc PE / Size 1217 / 38.03 GB

Free PE / Size 1 / 32.00 MB

VG UUID rmtJio-1AqZ-W8ZI-rt4P-4nuD-4pAP-Jo3rGb



--- Logical volume ---

LV Name /dev/VolGroup00/LogVol00

VG Name VolGroup00

LV UUID 1fQ23c-q2Gm-VSHA-cGby-vjTp-E7BD-OsDJfZ

LV Write Access read/write

LV Status available

# open 1

LV Size 37.53 GB

Current LE 1201

Segments 1

Allocation inherit

Read ahead sectors 0

Block device 253:0



--- Logical volume ---

LV Name /dev/VolGroup00/LogVol01

VG Name VolGroup00

LV UUID Vm0X6G-jhjZ-SqbI-iEKg-My91-zt2y-KmlNPp

LV Write Access read/write

LV Status available

# open 1

LV Size 512.00 MB

Current LE 16

Segments 1

Allocation inherit

Read ahead sectors 0

Block device 253:1



--- Physical volumes ---

PV Name /dev/hde2

PV UUID Dvb1gT-8ZxD-JNfG-tXh9-cloY-6hNz-25BqFS

PV Status allocatable

Total PE / Free PE 1218 / 1



-----------------------

Again, I don't see /dev/sda represented in here. Anyone know why or what to do?

In case a look in my /etc/fstab may be helpful:

-----------------------
/dev/VolGroup00/LogVol00 / ext3 defaults
1 1

LABEL=/boot /boot ext3 defaults
1 2

none /dev/pts devpts gid=5,mode=620
0 0

none /dev/shm tmpfs defaults
0 0

none /proc proc defaults
0 0

none /sys sysfs defaults
0 0

/dev/VolGroup00/LogVol01 swap swap defaults
0 0

/dev/hda /media/cdrecorder auto
pamconsole,exec,noauto,m

anaged 0 0

/dev/sda1 /media/usbdisk ext3
pamconsole,exec,noauto,n

oatime,sync,managed 0 0

[root at www jsj]#

-----------------------

I'd appreciate it if anyone can give me advice for mounting the LVM partition and maybe cleaning up the inconsistencies problem(I tried to Ghost the HD so I could experiment with a copy of it, but Ghost bombed out, citing inconsistencies on the disk).
Thank you very much in advance and sorry for the long post...



--John
 
Old 01-19-2007, 04:13 AM   #2
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
I have nothing to offer as I don't use the damn thing. For the kind of trouble people can get into I really wonder what kind of benefit one could justify by making a 2Gb partition into a LVM so that it cannot be mounted normally as a normal device like the /dev/sda2.

However I am sure the disk or the partition can be cloned by "dd" command as it would be the binary pattern of the device being copied and written. The partition is indeed recognised and so its partition boundary is defined as far as Linux is concerned.

If another hard drive, say with capacity larger than the one with LVM, is hooked as the sdb then this command should produce a mirror copy
Code:
dd if=/dev/sda of=/dev/sdb
I notice many Linux Live CDs check for the presence of LVMs to see if the drivers are needed to be loaded. This make me think if you hook the LVM disk to a PC that doesn't use Red Hat Linux or any Linux at all and boot up a Live CD you may at least be able to avoid the confusion of having the LVM name from the external disk clashes with one from an installed Linux. Other Linux are not that hot with LVM as the Red Hat distros. Just a thought as without another LVM presence your problem should be simpler.
 
Old 01-20-2007, 04:21 AM   #3
JohnJohnsonIII
LQ Newbie
 
Registered: Jan 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks!

Thank you for the reply. I will give that a try. If I do a binary copy, I should get the same linux and LVM partitions on the /dev/hdb, right? I plan on making another box soon, so I will try hooking it up as second drive at that point...thanks for your help and I will post the results of how this goes tomorrow. Thanks!

--John
 
Old 01-20-2007, 05:22 AM   #4
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
dd copies only the "1" and "0" of the media, doesn't care about the partition type and so even if Linux doesn't write on ntfs partitions (say without special program like ntfs-3g) every Linux can clone Windows XP or Vista. Therefore a LVM isn't an issue at all.

You should have no problem in making any number of exact duplicates of your disk or just the partition on its own. I often clone hard disks with various OSs inside and expect the cloned copies to boot exactly as the original when installing back in the same PC.
 
Old 01-20-2007, 01:48 PM   #5
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
I would recommend doing as saikee says, make a copy of your bad disk to another disk. His examples of dd should do the trick.

Now, disconnect the original (bad) disk and put it in a safe place. All work from now on should be done on your COPY.

Connect the COPY disk to your computer in some way. Via a USB enclosure, physically connected as the main drive, ... whatever.

Boot the system having this COPY disk connected using a Knoppix LiveCD. You don't want any other disks connected that may have LVM volumes on them too. I think this is the problem you ran into earlier (two identically-named LVM volume groups). Knoppix does not use LVM for itself, but version 5 supports LVM2, which is what you need to have.

After booting with Knoppix, grab a terminal window as root and make sure it can see your disk. "fdisk -l" should prove this.

Now run pvscan, then vgchange -a y. What does vgscan and lvscan tell you now? Can these commands see your original stuff? If so, we're starting to see daylight. If not, you may have some LVM corruption.

Assuming we're lucky and Knoppix sees your old stuff OK, it's time to check filesystem integrety. The lvscan would have listed your logical volumes, and THOSE are what you run fsck on. e.g., "/dev/VolGroup00/LogVol00". Use the fsck variant (with the force option) appropriate for the filesystem type you used (ext3? reiser? - I don't know what Fedora uses by default, or what you would have overridden and used).

Use fsck to fix any corruption you find in the filesystems (hopefully it's minor and easy to correct!)

Now you can try mounting the logical volume(s). That will go something like this (adjust for the volume group and logical volume names you found with vgscan and lvscan, and the filesystem type you origianlly used):
Code:
mkdir /mnt/tmp
mount -t ext3 /dev/VolGroup00/LogVol00 /mnt/tmp
The above represents the "lucky" case. If you actually have LVM corruption, things will get more difficult!
 
Old 01-21-2007, 12:35 AM   #6
JohnJohnsonIII
LQ Newbie
 
Registered: Jan 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Houston, we have a problem

It has taken me a while to get everything I need to do this. I bought another USB enclosure for the target 6GB hard disk. I checked to see which was which and then tried the disk clone via dd:
------------------

[root@timestamps ~]# dd if=/dev/sdb of=/dev/sdc
dd: reading `/dev/sdb': Input/output error
1271008+0 records in
1271008+0 records out
650756096 bytes (651 MB) copied, 251.758 seconds, 2.6 MB/s
------------------

I tried it on two different systems. After the error, the original drive disappears. If I physically power down my source drive and power up again, it becomes visible again. I am not sure what is going on. My motherboard went bad to end my last system--the disk was supposed to be fine...I have tried this four times now and it craps out at the same place each time.
Anyway, a look at fdisk on the target drive looks like the same structure, but I don't know if I trust it. If it was copying content, 651MB might be how much was on the disk, but if it was doing a binary copy of bit by bit, it had a way to go before completion of the 2GB copy. Any ideas? Does this mean I have to somehow do a repair on the disk...? On a Win system I would do a chkdisk about this time and hope the data could be moved...what does one do on a Linux partition? Thanks!

--John
 
Old 01-21-2007, 02:10 AM   #7
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Try your dd command again but add this to the end of it: "conv=noerror,notrunc"

The final command should look like this:
Code:
dd if=/dev/sdb of=/dev/sdc conv=noerror,notrunc
I just cut-n-pasted your original dd command string that you posted, so I assume you got your if and of specifications correct! Getting these backwards would be a total disaster!!! When doing a dd command like this, I always read and reread what I typed about 500 times to make SURE I got it right before I hit that <enter> key. You should too!

It looks like you have a bad spot on your disk that's causing the error. Could have happened when your system crashed I suppose. If the above modified dd command still doesn't work for you, you should look into ddrescue and dd_rhelp for your copying chore. These are even more error tolerant than dd with the conv=noerror parameter.
 
Old 01-22-2007, 12:31 AM   #8
JohnJohnsonIII
LQ Newbie
 
Registered: Jan 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks! I will try that first thing in the morning. The beauty of hardware crashes is that they happen at the worst possible time--in this case while we are moving our office. I will give it a whack in the morning and try to ressurect this beast. I will post later! Thanks!

--John
 
Old 02-05-2007, 07:03 PM   #9
JohnJohnsonIII
LQ Newbie
 
Registered: Jan 2007
Posts: 6

Original Poster
Rep: Reputation: 0
FINALLY tried!

Sorry for the delay. I was rarin' to go and work on it when the sky fell out. I made a Knoppix CD and was ready to test, but unfortunately, I had to migrate our mail server over to our new office. In the process my Exchange server died and my Dell workstation had an issue when the Dell tech guy's replacement memory fell out...looks like he didn't lock in the memory modules...needless to say, my personal Linux project got pushed back til today.
Anyway, I did the dd copy and got about 1.7GB of the 2GB system copied. When I did the pvscan I got a message or two like:
Couldn't find device with uuid "LOTSOFGARBLEDSTUFFHERE"
Likewise on the vgchange -a y i get similar messages along with the following messages:
"Couldn't find all physical volumes for volume group VolGroup00"
followed with a "Couldn't find VolGroup00". I would guess this is the corruption you mentioned...grrr...is salvage possible?

--John
 
Old 03-02-2007, 06:22 PM   #10
JohnJohnsonIII
LQ Newbie
 
Registered: Jan 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Any Ideas?
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hard Disk Recovery ShaneM Linux - Hardware 6 10-23-2006 03:38 PM
Hard Disk Recovery iacopop Linux - General 6 09-11-2006 08:04 AM
LVM - adding a new scsi hard disk ddaas Red Hat 1 07-28-2005 02:13 AM
Hard drive recovery, LVM Fonce Linux - Hardware 3 12-30-2004 09:47 PM
hard disk recovery kflano Linux - Hardware 9 12-09-2004 11:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:12 PM.

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