LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   LVM Nightmare! Have I lost my data? (https://www.linuxquestions.org/questions/linux-hardware-18/lvm-nightmare-have-i-lost-my-data-574474/)

MythN00b 08-03-2007 07:48 AM

LVM Nightmare! Have I lost my data?
 
My home server was running out of disk space...

I had a spare 250Gb drive - so decided to add it into my LVG on my FC6 machine and see how it all went....

STUPIDLY I didnt back up the important data first (months of photos of my kids... If I dont get that back I'm DEAD!)

Anyway - I added a new partition on the new drive, created a physical volume, added it all into the existing LVG, resized the logical volume...

All looked sweet - FC6 told me I had a new volume mounted in the right place of 250Gb more than I used to ....

Then I rebooted...

System didnt boot up - it told me it couldnt find all the physical volumes in the group.... Thats when I started sweating...

I had tried unplugging the disk and seeing if teh box would boot - but same message (which made sense since it couldnt find teh disk I'd just unplugged)...

I then googled around and found the "lvm" command line - that I can run from "Linux rescue" mode of the FC6 DVD.

I found the "lvremove" command in the hope of removing the reference to the new volume - but after running it (2nd STUPID mistake of the evening), it looks like its deleted the OLD lv too.

Now the system still doesnt boot... but I'm seriously afriad that I've lost my data and need to get a good divorce lawyer now!

Can anyone tell me if theres a way to get my data back?
ANY help would be extremely appreciated! I've got a 3yr old daughter who will go NUTS when she discovers she cant watch her "Dora explorer" videos on the MythTv box and a wife who'll put me in hospital!!


HELP ME OBI-WAN - YOURE MY ONLY HOPE!!!

theYinYeti 08-03-2007 08:06 AM

I think I remember a tool that scans a hard disk for known filesystems to recover data.
As you know, LVM acts as a layer above the hard disks, but the whole thing is still formatted using a standard filesystem. If I understand well, all your data is currently on a single hard disk, the other (latest PV added to the LVM) being empty for now. So there may be a recognizable filesystem on the used hard disk...

I'll try and find again what this tool was.

Yves.

syg00 08-03-2007 08:23 AM

I was going to offer you the name of my legal eagle, but I don't think he does divorces. But he is on Melbourne Street, so it's handy to the city ... ;-)

As for your other problem; presumably FC does all the vgscan/pvscan needed on boot. Might be worth trying Knoppix and see if you can get it to scan for the vg's.

theYinYeti 08-03-2007 08:27 AM

This is what I was thinking of:
http://www.cgsecurity.org/wiki/TestDisk

It is included in this good rescue LiveCD:
http://www.sysresccd.org/

Check also:
http://www.cgsecurity.org/wiki/PhotoRec

Good luck!

Yves.

monsm 08-03-2007 08:49 AM

If you combine the advice above. Get a live CD and try to mount the hard drive partitions directly without using LVM. I am no expert on this but I would think its possible as long as you are not running something like raid-0 like me...

When you know the data is intact you can search for a way fix the boot. Good luck.

theYinYeti 08-03-2007 09:06 AM

IF you attempt to mount partitions, then whenever you do it, do it read-only! (mount -o ro /dev/xxx /mount/point)

Yves.

MythN00b 08-03-2007 05:17 PM

All attemtps to mount drive manullay and read the data tell me its a completely empty directory.. ( I *think* and *hope* this is not true!)

I tried the live CD - but couldnt make head nor tail of wht it was supposed to be doing...

I also found an "LVM recovery" tool here: http://www.linuxdiskrecovery.com/linux-data-recovery
which does run on my windows box - BUT I cant get my windows box to boot when the linux drive is plugged into an IDE cable:mad:

If it wasnt the weekedn I'd be on the phone to a pro 'data recovery' person by now and handing over vast quantityies of cash to get my data back!!

syg00 08-03-2007 06:17 PM

I still think Knoppix is worth a shot. Have a look at this thread f'instance.
Searching for other posts by haertig (on LVM) would be productive.

jay73 08-03-2007 08:01 PM

Don't panic. No matter what you did, the data were NOT erased. At worst you simply screwed up their meta-data so that they have become invisible to the operating system. Can the drive be accessed from a liveCD such as Knoppix?

MythN00b 08-04-2007 06:17 PM

Cant get knoppix to work sensibly - The screen resolution on my crappy old tv is not good enough to see whats going on - and when I plug a monitor in the display drivers get confused and everything just shimmers 'cos the scan/refresh rate is obviously wrong....

I've resigned myself to handing the disk over to a recovery servce. It will cost me an arm and a leg - but at least I will get the data back. If I try and get too clever I risk doing further damage!...

jay73 08-05-2007 02:56 AM

Can you run fdisk -l? I wouldn't be surprised it is device type was changed as a consequence of including it in the lvm group. If it really was, then you should be able to recover be reverting to the original type. I did something similar on one occasion when I had accidentally wiped my partition table. It only took a few seconds.

alabamaman 09-19-2007 04:22 PM

Quote:

Originally Posted by jay73 (Post 2848392)
Can you run fdisk -l? I wouldn't be surprised it is device type was changed as a consequence of including it in the lvm group. If it really was, then you should be able to recover be reverting to the original type. I did something similar on one occasion when I had accidentally wiped my partition table. It only took a few seconds.

i'm pretty much having this same problem, and i have a FC7 livecd in now. here's my fdisk results...

Code:

[root@localhost ~]# fdisk -l

Disk /dev/sda: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 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      24321  195254010  8e  Linux LVM

Disk /dev/dm-0: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/dm-0 doesn't contain a valid partition table

i'm assuming since they're now "dev/sda" instead of "dev/hda" the device type was changed like you mentioned? or are those just the dummy mounts for the livecd and my drive is toast? i too have about 200GB of valuable data on this drive i'd rather not have to recover later on so i'm trying to avoid it. i'm just looking for some hope that the drive isn't dead.

jay73 09-19-2007 06:48 PM

The disk being referenced as sda instead of hda is an unrelated phenomenon. Fedora 7 designates both PATA and SATA disks as sd rather than hd (pata) versus sd (sata). So if you check from a Fedora 7 livecd, it will find only sds.

I think it would be helpful if you could be more precise about what went wrong. Did you add storage? Did you try to resize a partition? What were you trying to achieve and what did you end up with?

alabamaman 09-20-2007 10:01 AM

Quote:

Originally Posted by jay73 (Post 2897305)
The disk being referenced as sda instead of hda is an unrelated phenomenon. Fedora 7 designates both PATA and SATA disks as sd rather than hd (pata) versus sd (sata). So if you check from a Fedora 7 livecd, it will find only sds.

I think it would be helpful if you could be more precise about what went wrong. Did you add storage? Did you try to resize a partition? What were you trying to achieve and what did you end up with?

sorry about that, i did add storage and created another logical volume with that drive which was evidently a really stupid idea because when i rebooted i just got a grub> screen. i don't care about having the other drive in there, i just want my os back without having to reinstall. everytime i try to do anything from the grub screen i get "cannot mount volume" etc. i have another post going about it over here...

http://www.linuxquestions.org/questi...d.php?t=585860

MythN00b 09-20-2007 09:42 PM

Well heres my update:

I gave my disks to a data recovery place - they charged me a small amount to "report" on what data could be recovered. Of course they did find everything... - but said it was much harder than they expected and wanted to charge me AU$1000 to recover it.

Fortunately for me I discovered I *DID* have an inadvertent back-up of all the important stuff on various windows boxes around the house - so I got my disks back and started playing.

I used the LVM command line tool to remove all volumes, removed any nasty looking volume references from fstab and rebooted. It worked!!!
next step was to recreate the LogicalVolume - which I did using the GUI tools in FC6 and it all worked beautifully.

I now have a system with all my data restored (took a while to copy it from various different locations desktops, laptops etc) and with double the disk space I had before!

Consider the lesson learnt though! Before playing with ANY configuration make SURE theres a good backup of everything - and if you cant do a backup for some reason then DONT touch it!!! lol


All times are GMT -5. The time now is 05:50 AM.