LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   I have Lose my data because LVM partition lose (http://www.linuxquestions.org/questions/linux-server-73/i-have-lose-my-data-because-lvm-partition-lose-655259/)

iwantofree 07-12-2008 04:44 AM

I have Lose my data because LVM partition lose
 
Dear All,

1 month ago, my Server Hang/Crash, using Fedora 4., HDD SCSI 36 GB
It have /boot, LVM( / , swap) partition
HDD have Bad sector . so maybe HDD corrupt.

The problem is, LVM (Volume Group) loss, so my / an swap is loss

I try using live CD, and try to mount this HDD
this HDD , in /dev/sdb1 ->
/dev/sdb2 ->

I cannot mount /dev/sdb2 because it's busy, but notting in mount

I try to recovery , with make LVM to active, but notting to solve

Dear All,
Please help me to recovery my data, to active my LVM and show all my data.


thx
iwant

fatra2 07-12-2008 05:10 AM

Hi there,

A little bit more informations would not harm to understand your problem. Let's say that the result is pretty clear, but without the cause, it is pointless to try and help.

What caused your server to "hang/crash"? Did you try to repartition your HDD, which caused an big poopoo, and now you would like to recover from that??? When you boot from a live CD, can you access your HDD, and can you see any error log, that could explain what caused your server to crash?

With these information, we should be able to help you better.

Cheers

iwantofree 07-23-2008 08:54 AM

I have Lose my data because LVM
Thx for you attention, I am try to remember what happen in my HDD/Server

What happen in Last time my server ?
It's cannot booting

Before this time, some message display every day like:
I/O error dev sda sector 17996173,

Now, My Server cannot booting.
I Try to remember some message display in last time :
checking file system
/:clean; (????) / (?????) file, (????) /(????) blocks {-> Sorry I Don't remember this number!@!## }
fsck.ext3: No such file or directory while trying to open /dev/VolGroup00/LogVol00
/dev/VolGroup00/LogVol00:
the superblock could not be read or does not describe a correct ext2 filesystem.
If the device is valid and it really contains an ext2 filesystem (and ot swap or
ufs or something else), then the superblock is corrupt, and you might try running
e2fsck with an alternate superblock:
e2fsck -b 8193

use password administrator :

This HDD takes /boot, swap, and /
I never create LVM before, but in this case maybe LVM create automatic
It's make surprise.

next , I want inform something :

1. I use Software HDD Regenerator 1,51, it's recomended by my friend, it's nothing
2. I try to connect this HDD with Centos Linux,
[ ]# fdisk -l
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 650 5116702+ 82 Linux swap
/dev/sda3 651 19457 151067227+ 83 Linux

Disk /dev/sdb:

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 13 104391 83 Linux
/dev/sdb2 * 14 ??? ??? 83 Linux {-> Sorry I Don't remember }

[ ]# mkdir disk1 disk2
[ ]# vi /etc/fstab
##Added

/dev/sdb1 /hdbaru/partisi1 ext3 defaults 1 1
/dev/sdb2 /hdbaru/partisi1 ext3 defaults 1 1


[ ]# mount -a -> nothing because the /dev/sdb2 partition is busy

3. I Try to booting with Live CD, (nothing)

4. I Try to booting with Live Gparted,
Display 2 partition, /boot and (one more partition)
One more partition haven't file system,
5. I Try again connect this HDD with Centos Linux,
I think this problem lose LVM partition, so I try to change system id (it's nothing)

[ ]# fdisk /dev/sdb

I change a partition system id from 83 to 8e (LVM)
but it's not formatted

[ ]# vgscan or lvscan ( I cannot user this, it's nothing LVM volume)

6. I try user some software Linux recovery partition (It's notting)

7. Now this HDD takes /boot , but one more partition is blank, haven't file system

Now, I want my data , please help me, thx

fatra2 07-23-2008 09:42 AM

Hi there,

Without being an expert in the field, I would say that you have a serious problem. I still have some questions about your post: why are your partitions called "sda1"??? I always thought that sd partitions were for USB devices. Did you install Linux on an external USB HDD???

Do you remember what happened after you entered the root password, for e2fsck to check your disk??? Let's say that if you had very bad blocks, e2fsck might have tried to write to them, and destroyed vital information.

Know my best bet is that you will have to reinstall your system from scratch. Before doing so, you should actually try to boot again from Gparted live CD. You said that you see two partition, when booting from the live CD: /boot and the other one. I guess that is where your data should be. Can you access this partition: mount it in anyway.

b0uncer 07-23-2008 10:50 AM

Quote:

Originally Posted by fatra2 (Post 3223694)
I still have some questions about your post: why are your partitions called "sda1"??? I always thought that sd partitions were for USB devices. Did you install Linux on an external USB HDD???

Awful many question marks there :) One should do. But anyway, IDE disks used to be presented as hdXn etc., whereas today some distributions simply use sdXn for all harddisk types (IDE too). So it's not just USB devices and such that get the sd.. device files, but IDE disks too.

If you have another computer where you can put the disk in as a second drive, you should maybe do so and use a disk cloning utility to make a one-to-one copy of the disk (the image created will be large, as big as the disk, so for a "small" 40GB disk you'll get a 40GB image, which means you're going to need another equally sized harddisk or some other big media to write that on); if you use Linux, "dd" can do it. This is because if you work on the original disk, chances are you'll more or less accidentally lose any data that might still be there. So better take an image copy of the disk if there's valuable information there..then you can either work on the image and not touch the original disk, or work on the original disk and keep the image safe in case you need it later.

Then get familiar with the lvm (lvm2) tools on Linux, how you activate lvm groups and mount the partitions inside. Once that's clear, try to mount the partitions on the disk read-only (if you enable writing, you might end up overwriting something). If the disk is really corrupt, that might not work.

One chance is to use a commercial data recovery company; they will charge you a nice big sum of money, but they're usually your best bet if you have valuable data on the disk and don't get it out easily yourself. The folks at such companies can, in some cases, retrieve data from badly damaged disk (at least some of the data), and if you think it's worth it, send the disk to them and don't corrupt it any more with personal tweakings. If you don't think it's worth the money, keep on recovering it yourself, but remember that it's quite possible you don't get anything out.

Especially because it was a server you should have taken backups of the important data, and probably now you'll understand why: had you done so, you would only need to get a new harddisk, install OS on it and push the backup data back to the system. Next time you perhaps remember to do so.. And if you knew before the crash/breakdown there were I/O errors on the disk, you should have been alarmed by then already, bought a spare disk and moved the data from the dying disk to the newer one :) Harddisks are typically the weakest pieces of today's computers, and when they start showing signs of breaking, there's no sense in waiting for them to miraculously cure themselves - it's a one-way downhill road, and the only good thing to do is to have backups and have a fresh spare disk to move on.

iwantofree 07-24-2008 03:41 AM

We used SCSI HDD, so linux presented by sdb / sda /sdX

iwantofree 07-24-2008 06:59 AM

b0uncer thx a lot of, I finished to Clonning my SCSI HDD 36GB to IDE HDD 80GB success.

What the Next ,...???, I will try to get the lvm (lvm2) tools on Linux

Thx

unSpawn 07-24-2008 08:07 AM

Quote:

Originally Posted by iwantofree (Post 3224763)
I finished to Clonning my SCSI HDD 36GB to IDE HDD 80GB success.

What tool and commandline did you use to clone the disk?
If your original disk had disk errors like you claimed in your original post, then how succesful was cloning?
Did the process clone the whole disk or did you assume it did?


The next step would be to remount your 80GB "backup disk" readonly since it's your only backup right now and you don't want to make changes while you practice with things. Once it's mounted readonly (which isn't the same as changing access rights on the mountpoint, directory or file) you have to mount the image (if you used 'dd' or equivalent) as root with something like 'losetup /dev/loop0 /path/to/imagefilename'. Check your LVM configs that they don't have disabled some paths not to scan, then you can pvscan /dev/loop0. If you used LVM2 then you could have multiple PV blocks but only if you explicitly configured it so in pvcreate.

iwantofree 08-01-2008 07:31 AM

Quote:

What tool and commandline did you use to clone the disk?
If your original disk had disk errors like you claimed in your original post, then how succesful was cloning?
Did the process clone the whole disk or did you assume it did?
I use commandline dd to clone HDD SCSI to HDD IDE ( +/- 3 hours)
After finish this clonning, I try to compare HDD in disk space/partition , so i think succesfull.

IF I use SCSI HDD, it's very hot, maybe there is some problem in HDD
Now, SCSI HDD put, some day I need it.

Now I try with HDD IDE (80 GB),

I change id 2'nd partition from 8e (LVM) to 83 (ext)
Why this,because SCSI HDD after error, I try to change ID from 83 to 8e to get LVM partition again. So I try to re id,

[root@dq ~]# fdisk /dev/hda
chose : t --partition 2 -- 83 --
chose : u
chose : q
and, 2'nd partition chaged System : Linux LVM to Linux

After restart my server, there is some dispaly error :
Booting Fedora Core(2.6.11-1.1369-FC4smp)

root(hd0,0)
File system tye is etx2fs, partition type 0x83
kernel vmlinuz-2.6.11-1.1369-FCsmp ro root=/dev/VolGroup00/LogVol00 rhgb quiet
[Linux-bzImage, setup=0x1e00, size=0x17a6e3]
initrad/initrd-2.6.11-1.1369-FCsmp.img
[Linux-inittrd @ 0x37e26000, 0x1c91cc bytes]
Uncompressing Linux....IOK, booting the kernel
Redhat nas version 4.2.15 starting

Reading all physical volumes, this may taje a while.
No Volumegroup found
Unable to find volume group "VolGroup00"

ERROR " /bin/lvm' exited abnormally with value 5 !(pid 441)
mount : error mounting ext3
ERROR /dev/consoler !!! :2
error dup2'ing fd 0 to 0
error dup2'ing fd 0 to 1
error dup2'ing fd 0 to 2

switch root: mount failed :22
Kernel panic - not syncing : Attemted to kiill init !!!

How to solve this??
Thx

jschiwal 08-01-2008 08:09 AM

First make sure you have the "dm-mod" and "dm-snapshot" modules loaded.

In one of your posts you tried to mount the swap partition. Use swap on instead.
Obviously the first partition is the boot partition given it's small size. Don't change the partition ID from lvm to linux. That won't help and may prevent the kernel from mapping the Logical Volumes.

There probably is a line like
/dev/system/rootvol / ext3 acl,user_xattr 1 1

in your /etc/fstab file. If you can boot up using a live distro, see if the kernel has found the lvm volume. It's the kernels job to assemble the lvm array.
Take a look at ls -l /dev/mapper/. Also there may be devices such as /dev/dm-0, /dev/dm-1, /dev-dm-2, etc. These are the same devices.

Also look at "lvmdiskscan"
Code:

lvmdiskscan
  /dev/sde: open failed: No medium found
  /dev/sdf: open failed: No medium found
  /dev/sdg: open failed: No medium found
  /dev/sdh: open failed: No medium found
  /dev/loop0 [        4.33 GB]
  /dev/dm-0  [      546.50 GB]
  /dev/sda1  [      465.76 GB] LVM physical volume
  /dev/dm-1  [      46.94 GB]
  /dev/dm-2  [      60.00 GB]
  /dev/sdb1  [      83.05 GB]
  /dev/sdb3  [        8.80 GB]
  /dev/sdb5  [      141.03 GB]
  /dev/sdc1  [      156.85 MB]
  /dev/sdc2  [        2.01 GB]
  /dev/sdc5  [      60.00 GB] LVM physical volume
  /dev/sdc6  [      127.75 GB] LVM physical volume
  /dev/sdd1  [        8.81 GB]
  /dev/sdd2  [      289.28 GB]
  0 disks
  11 partitions
  0 LVM physical volume whole disks
  3 LVM physical volumes

Instead of mounting a disk device, you mount a logical partition.
Code:

lvscan
  ACTIVE            '/dev/system/home' [546.50 GB] inherit
  ACTIVE            '/dev/system/rootvol' [46.94 GB] inherit
  ACTIVE            '/dev/system/usr' [60.00 GB] inherit

From a live distro, you may need to mount a device such as /dev/dm-0 on /mnt. It may take trial and error until you find which one is the root partition. Here I could mount /dev/system/rootvol on /mnt, and /dev/system/home on /mnt/home and /dev/system/usr on /mnt/usr.

Code:

hpmedia:~ # ls /dev/dm-* -l
brw-r----- 1 root disk 253, 0 Jul 31 02:25 /dev/dm-0
brw-r----- 1 root disk 253, 1 Jul 31 02:25 /dev/dm-1
brw-r----- 1 root disk 253, 2 Jul 31 02:25 /dev/dm-2
hpmedia:~ # ls /dev/mapper/ -l
total 0
lrwxrwxrwx 1 root root    16 Jul 31 02:25 control -> ../device-mapper
brw------- 1 root root 253, 0 Jul 31 02:25 system-home
brw------- 1 root root 253, 1 Jul 31 02:25 system-rootvol
brw------- 1 root root 253, 2 Jul 31 02:25 system-usr

Notice the major and minor numbers on the devices. /dev/dm-0 <=> /dev/mapper/system-home, /dev/dm-1 <=> /dev/mapper/system-root/vol and /dev/dm-2 <=> /dev/mapper/system-usr.
So I could have mounted /dev/dm-1 instead of /dev/mapper/system-rootvol.

Another thing you could try is "lvdisplay". Are any of the logical volumes listed. Perhaps system-usr can't but system-home can. Perhaps you can mount and access all of the logical volumes but one.

If you have a drive problem rather than a filesystem problem, running a utility like spinrite on the disk might be able to recover enough for you to mount the LVs and make a backup before replacing the drive.

There are other utility programs and if you can get at it an /etc/lvm/backup/ directory containing the structure of the LVM array. Enter "lvm" by itself for a long list of other lvm programs.


All times are GMT -5. The time now is 10:34 PM.