How to mount an LVM partition on another system

I ran into a Fedora Core 3 box recently which after rebooting was unable to mount the root filesystem. Here's what I did to get this going:

First I booted off the Fedora CD and typed "linux rescue" at the prompt in order to boot into rescue mode. When asked if I would like to enable the network interfaces or mount the filesystems, I said no to both.

If you are running a different Linux distro or don't have the Fedora CD, I'm pretty sure you can use a different Linux bootable CD like Knoppix and then just install the LVM tools (How to install LVM tools on Knoppix) and use that instead.

So, once you're at the command prompt, you need to activate the LVM partitions so they can be used. This can be done using the following command:

lvm vgchange --ignorelockingfailure -P -a y

The -P will make logical volumes which are missing one of their disks available too.

This should create the device entries for these logical volumes. You can find out what the name of the logical volumes are by typing:

lvm lvs

This should give you output showing the name of the Volume Group and the name of the Logical Volume. The device entry should be created in /dev/<Volume Group Name>/<Logicial Volume Name>. So in my case it was created as /dev/VolGroup00/LogVol00.

You can now mount or fsck or whatever you need to do. If you wanted to check/repair the filesystem you could run:

fsck /dev/VolGroup00/LogVol00

If you wanted to mount the filesystem you could run:

mkdir /volmount
mount /dev/VolGroup00/LogVol00 /volmount

And that's it, you now have access to your logical volume on another system. Please leave any comments or corrections using the comment form below.


Author: DPAK
Created: Jan 23 2006
Categories: Linux
TechByte #118

Warning: By visiting this site and/or by using any information contained herein, you agree to the Techbytes.ca terms of use.


Comment posted by 'Nathan Hawks' on Oct 20 2007 @ 17:31:52
I want to massage your feet and wash them with my hair right now. I have been struggling with this for several hours when I should have been working! I caused a problem playing around with hdparm on my IDE drive which somehow caused a very dirty drive and, as you know, until I read this post, 'linux rescue' was putting me in a catch 22. Now I just hope that all these 'y's I'm giving to fsck aren't going to blow away my ability to boot or any of my work data :) But hell, at least now I /can/ fsck!!!!

You. Dat. Awesome.

Add a comment about this TechByte

If you wish to add a comment regarding this TechByte, please use the form below. Please note that by submitting comments using this form you are allowing all of the information submitted to be visible on this website. Any comments submitted using this form will only be shown on the website if they are approved by the administrators of this site. IF APPROVED, COMMENTS MAY TAKE SEVERAL DAYS TO BE POSTED.

Posted By: (Optional)

Comments:


Other TechBytes: