Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
---------------------
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?
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...
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.
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!
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.
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!
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!
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.
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!
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?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.