LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Mounting LVM drive as a recovery effort (https://www.linuxquestions.org/questions/linux-hardware-18/mounting-lvm-drive-as-a-recovery-effort-398388/)

carlfacer 01-01-2006 01:40 PM

Mounting LVM drive as a recovery effort
 
This may be a little weird, so try to follow me ..

About two weeks ago, I was attempting to install a voicemail server on my Fedora Core 4 box and it asked for me to uninstall mgetty, and reinstall a patched version. Well, I used YUM Extender to perform the uninstall, but it also removed every single dependency along with it. As you can guess, I pulled a Paul Bunyon and almost took out the whole system with one swipe. I am able to use CD1 in rescue mode, and view all the data on the drive, but the system gets a "kernel panic" while attempting to boot normally. Unless someone can find a fix for my n00bish error, I will just attempt to recover the data and put it onto a new install of FC4, which I've got on another drive.

I threw in a different drive, and installed FC4 on it (to have a LVM capable environment in which to work). My problem is that I can not figure out how to mount the old HD, as it uses LVM (which I'm not too familiar with) and I don't have that much time for research (Work full time and Paramedic Student).

Here is the output of fdisk -l :
Code:

[root@localhost ~]# fdisk -l

Disk /dev/hdc: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hdc1  *          1          13      104391  83  Linux
/dev/hdc2              14        9729    78043770  8e  Linux LVM

Disk /dev/hdg: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hdg1  *          1          13      104391  83  Linux
/dev/hdg2              14        4865    38973690  8e  Linux LVM

And here is the output of pvscan :
Code:

[root@localhost ~]# pvscan
  PV /dev/hdc2  VG VolGroup00  lvm2 [74.41 GB / 32.00 MB free]
  Total: 1 [74.41 GB] / in use: 1 [74.41 GB] / in no VG: 0 [0  ]



hdc is the new drive that I am running FC4 from, and hdg contains the fubar'd drive.

Also, if there is a somewhat easy way to restore the original drive (by other means than reinstalling each individual RPM as I have already tried, and decided that I don't have enough time to do) I would be eternally grateful.


Any help would be greatly appreciated and further information can be provided, if someone can give me a good place to start.

Thanks!
-Carl

jcliburn 01-01-2006 06:15 PM

It's for this very reason that I won't use LVM anymore. It's just too darn much trouble to rescue anything from it.

There's a recent thread over at the fedora-list. Here's something that might help.

Jim Cornette wrote:

I searched the archives for whatever I had to do in order to get the
lvm activated. Here is one posting that I made:

https://www.redhat.com/archives/fedo.../msg01943.html

From an earlier posting someone suggested to run the following commands
to activate and later deactivate LVM volumes in rescue mode. I used
these commands on an external USB drive to get at data from a previous
installation and it worked. You might be able to get at your data in
this way.
Jim

Excerpt from earlier help.
Once booted into text-mode rescue, invoke the following commands:


lvm lvscan
lvm vgchange -ay


This will scan for all LVM volumes and then will make them active and
accessible.

lvm vgchange -an

will deactivate them all.
end Excerpt:

Basically, the LVM volumes on the hard drive from an earlier install was
labeled / for the main partition and this label being the same as my
non-lvm clean install was also labeled /. When the kernel booted and the
saw the same label, it ignored the LVM which contained the / and swap
lvm content.
To access the partition, I ran the lvscan and vgchange commands. I then
had to make a mountpoint under /mnt to mount the LVM partition.
I believe I got the information as /dev-mapper/volgroup00/<whatever> ---
Sorry, I forgot what it is called, I no longer use LVM.
I took that information of where the volume was and used mount
/dev-mapper/volgroup00/<whatever> /mnt/olddrive and was able to access
all the content from the LVM after mounting it. I transferred all of my
desired information from the drive and never used it since.

There might be discussions in march of this year or close to that time
frame in the archives. The helpful person has not posted recently to my
knowledge but knew a lot about dealing with LVMs.

All of your swap partitions and other filesystem dvisions are all
contained in the LVM. The only partitions you should have are the one
for windows, the /boot partition and the third partition should be where
all of the LVM "partitions" or slices are kept. If you ran fdisk on the
/dev/sdb device, you should have three partitions. Without dev-mapper,
it does not show.

Good luck! It is possible, I just cannot remember the exact method that
I used to get at the LVM.

Jim


All times are GMT -5. The time now is 03:15 PM.