LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices

Reply
 
Search this Thread
Old 06-06-2006, 02:06 AM   #1
laxisusous
LQ Newbie
 
Registered: Sep 2003
Posts: 23

Rep: Reputation: 15
Did using LVM commands erase existing data?


Help. I had Fedora Core 3, and wanted to upgrade to Fedora Core 5. I bought a new hard drive and installed FC5 on it. That is all fine. I was struggling to transfer my old files across to the new hard drive as both FC3 and FC5 both use LVM and the VolGroups and the LVs are both the same.

On FC5 I could see that the physical drive was there, but it couldn't see the VolGroup or the LogicalVolume. LVM could see the VolGroup and LogVolumes of the running filesystem just fine.

So following the advice of a website I created a VolGroup for my old drive, named 'main'. This was likely a huge mistake, but everything I read from that site and others seemed to make it look like everything was going to be virtual and wouldn't write to the physical drive.

Then I tried booting the old system and it found 'main' which is horrible as the old VolGroup is gone. It of course can't boot. Creating a new LogicalVol didn't help (I was grasping at straws).

Is there a way to reset my old VolGroup and LV info to what it should be, VolGroup00/LogVol00, or is all my old data lost forever?

And assuming (Lord willing) that I am able to get my old data back, is there a way to mount a LVM'ed drive to another LVM filesystem when they both have the same name?

Please help - that's a lot of data to lose.

laxisusous
 
Old 06-06-2006, 03:51 AM   #2
nabeelmoidu
Member
 
Registered: Jul 2005
Location: Bangalore
Distribution: Fedora
Posts: 71

Rep: Reputation: 15
Was your old root filesystem on the LVM partition ?
If you can get your /etc/lvm/archive folder , and as long as you haven't formatted your disk ,everything else shouldn't have destroyed your data.
Coz all the LVM metadata is stored separately and and the actual data is not changed when the metadata is altered.
 
Old 06-06-2006, 07:12 AM   #3
laxisusous
LQ Newbie
 
Registered: Sep 2003
Posts: 23

Original Poster
Rep: Reputation: 15
Thank you for your quick reply. Yes, my root "/" directory is on the LVM as that is the standard Fedora install. I'm wondering if I could just boot from a LiveCD or anything other than Fedora (as it has the matching VolGroup info) and artifically plug in the data. Problem is - I'm not too sure what that data should be. I'm a slight beginner when it comes to Linux, but a complete noobie when it comes to LVM. I can see why a sysadmin would use it, but I'm just using it for a home computer.

Any ideas on what info I would want to plug in? Even if I could just mount the drive (partition), then I could just cp the files over to the new drive. If that were possible I would be jumping with glee.

laxisusous
 
Old 06-06-2006, 08:22 AM   #4
nabeelmoidu
Member
 
Registered: Jul 2005
Location: Bangalore
Distribution: Fedora
Posts: 71

Rep: Reputation: 15
I would suggest you check out the lvm channel on irc.freenode.net

If it were on a different folder , you could have restored the configuration using the backup archive.Maybe someone else might be able to help you.
 
Old 06-06-2006, 08:26 AM   #5
GL1800
Member
 
Registered: Jun 2005
Location: Lilburn, Ga
Distribution: FC5
Posts: 175

Rep: Reputation: 30
FC5 includes a rescue CD. That _might_ allow you to mount the old / partition, also, many people use Knoppix at times like these, as a method of gaining access to the data.
 
Old 06-06-2006, 09:34 AM   #6
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,154

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
I had a similar problem. Here's my solution, which has been working well.

The problem is not your LVM rename, but that the initrd generated for you FC3 needs to be changed to reference the new name instead of the (hard coded at the time of the install) old name. My solution was to activate ALL the logical volumes, so GRUB could specify the actual /root at boot time, but the mkinitrd maintainer did not accept the suggestion as a bug to be fixed.
 
Old 06-06-2006, 06:11 PM   #7
laxisusous
LQ Newbie
 
Registered: Sep 2003
Posts: 23

Original Poster
Rep: Reputation: 15
I might have a glimmer of hope. When I was setting up my FC5 at first I threw a copy of my /etc folder on a CD-ROM and placed that on my FC5 Desktop. Looking at etc/lvm I find that the archive and backup folders are empty. The lvm.conf file has lots of info but I can't find anything regarding VolGroups or LV's on it. This has me worried.

I found that the Gentoo LiveCD has lvm2 support so I will be downloading that. If all I have to do is load into Gentoo and change the VolGroup name and LV name back that would be great - but from what I see it seems that the LogicalVol needs input on size etc, and I wouldn't know what to put in.

I had FC5 isos downloaded on my FC3 system. I burned all the CD's except the emergency disk.

lax
 
Old 06-06-2006, 06:18 PM   #8
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
The 2006.0 Gentoo LiveCD did not recognize my FC5 created LVM partitions. In fact, despite trying to install to another completely different (non-LVM) partition it trashed the entire volume group.
 
Old 06-06-2006, 09:05 PM   #9
laxisusous
LQ Newbie
 
Registered: Sep 2003
Posts: 23

Original Poster
Rep: Reputation: 15
Now I've really done it. I think that I have now made it even harder (imposible) to recover my data. Decided to try mounting the FC3 drive into the FC5 filesystem. First I extended the LV to the whole drive. Then I tried to mount it, but it kept asking for a filesystem type - as would be expected. But with the new LVM'ing it never assigned itself a filesystem type. So like a fool I assigned it one (ext2). Now when I look at what is mounted all that is inside is "lost+fount". Ouch. I think my only option now is a data recovery company.

Anyone have any ideas? Do I need to take the expensive route?
 
Old 06-07-2006, 06:31 AM   #10
nabeelmoidu
Member
 
Registered: Jul 2005
Location: Bangalore
Distribution: Fedora
Posts: 71

Rep: Reputation: 15
Try out this

If you have the backup of /etc/lvm , I think you can get back your data ( again , unless you have formatted any of the partitions) .
I have done this once , but I don't remember the step by step process of that.Wish I had begun blogging then itself.
This blog looks something similar.
http://codeworks.gnomedia.com/archiv.../lvm_recovery/

But basically you will need to create the PVs once more , and then reconfigure the VGs with the latest you will find in the /etc/lvm/archive folder using vgcfgrestore command.Open up the vg files in vi , you will be able to find some details to figure out which is the config that you had when it was last working fine.

Last edited by nabeelmoidu; 06-07-2006 at 06:34 AM.
 
Old 06-07-2006, 07:43 AM   #11
worzel68
Member
 
Registered: May 2006
Location: Sydney
Distribution: FC5, FC3, AIX, System V,
Posts: 50

Rep: Reputation: 15
I have a new disk with no LVM but the old disk has one, to mount the old disk all I did was this:

mount -t auto /dev/VolGroup00/LogVol00 /media/hda

/media/hda is a mount point that I created.

Your situation might be different with regard to the location of each VolGroup, I would have thought it not neccessary to alter LVM extents just to mount the volume.

The other thing I have done is edit /etc/grub.conf so that I can choose which system to boot ( I still have FC3 on my old drive)

It's also a good Idea to have a small (100MB) boot Partition as the 1st partition because grub basically identifies things by hd numbers & partition numbers and not by directory.
Any way I hope this might help you.
 
Old 06-07-2006, 04:23 PM   #12
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,154

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
laxisusous, everyone seems to be ignoring my comment, above, so maybe it was off the mark.

Have you done a pvscan with your HDs connected? From what you said, it should show two different volume groups: VolGrp000 and main. If it doesn't, the you didn't actually change the name of your FC3 logical volume to main.

If you did make the change, the only way you can boot to the OS on that drive, as far as I know, is to have you initial ram drive actually use that drive. On the other hand, if you just want to access the data on the drive, there should be an entry in dev/mapper/main for each logical drive in the LV main that you can mount in your FC5 system. As an example, here're a few lines from my /etc/fstab
Code:
$ cat /etc/fstab | grep ext3
/dev/FC5/LogVol00       /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
LABEL=/shared           /shared                 ext3    defaults        1 2
/dev/FC4/LogVol00       /mnt/fc4                ext3    defaults        1 2
/dev/hdb2               /mnt/fc4/boot           ext3    defaults        1 2
/dev/hdh2               /mnt/fc3                ext3    defaults        1 2
/dev/hdh1               /mnt/fc3/boot           ext3    defaults        1 2
Edit: Oh, here's what I get from /dev/mapper:
Code:
$ ls /dev/mapper/
control  FC5-LogVol00  FC5-LogVol01  FC4-LogVol00  FC4-LogVol01

Last edited by PTrenholme; 06-07-2006 at 04:27 PM.
 
Old 06-08-2006, 01:17 AM   #13
laxisusous
LQ Newbie
 
Registered: Sep 2003
Posts: 23

Original Poster
Rep: Reputation: 15
PTrenholme

Yes I do have the VolGroup of 'main'. It also has a LogVol called 'lvol0'. So I first set all VolGroups to active. When I go to mount it with the command.

mount -t ext3 /dev/main/lvol0 /mnt/old

I find that all the is in /mnt/old is

lost+found

Which seems to tell me that the system has been reset/initialized. It appears that the data is lost and gone forever.

BTW: I called but one company that does data recovery. They charge US$70 for trying and failing to recover, and US$270 for trying and succeeding to recover. Too rich for my blood.

lax
 
Old 06-08-2006, 01:37 PM   #14
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,154

Rep: Reputation: 333Reputation: 333Reputation: 333Reputation: 333
Well, I can understand your reluctance to pay that much for data recovery, although that's fairly inexpensive, and -- if you data contained, for example, the results of expensive experiments -- the price might be quite reasonable. (Before I retired, I worked as a biostatistician for a drug company, and the results for a single patient trying a new drug could cost more than 5000 Swiss Franks. Loss of the results for a whole experiment could cost several millon. [Of course, we alwyes had multiple back-ups for that kind of data.])

If your data are all in lost+found, it may, in fact, still be available. It's possible that all that was lost was the directory file, and an examination of the files in the lost+found directory might let you recover at least your critical data. (Of course, if lost+found is enpty you're lost.)

If your data are, in part, text files, something as simple as grep (or the find application in KDE, if you use KDE) can identify specific files containing specific text strings or patterns. Once identified, they can, of course, be copied to wherever you want.

Edit: By the way, you can do a grep on the output of a dd of the whole drive, but reconstricting the file chains can be rather difficult.

If you just want to chalk it you to a learning experiance, the value of frequent back-up is one thing to be considered.

Last edited by PTrenholme; 06-08-2006 at 01:42 PM.
 
  


Reply


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
How to extend an existing partition without LVM james.reid Linux - Software 14 06-02-2006 01:48 AM
RAID/LVM setup with existing drives juu801 Linux - General 3 07-06-2005 01:35 AM
Resize existing and add another partition with LVM donv2 Linux - Newbie 3 04-27-2005 05:23 AM
Manage disks on an existing system with LVM doris Linux - Hardware 1 03-02-2005 03:37 PM
existing LVM partition won't mount anymore dehuszar Linux - Software 1 09-10-2004 02:26 PM


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