/ on LVM and rescue

Kurt Granroth kurt+plug-discuss at granroth.com
Sat Apr 19 17:06:16 MST 2008


der.hans wrote:
> RedHat defaults to putting root on an LVM. It generally boots and works
> fine.
> 
> For the times where it doesn't boot correctly, I'm trying to learn how to
> rescue the system.
> 
> I'm trying to use System Rescue CD to boot the currently installed system.
> It's not working.
> 
> Grub lists root as /dev/VolGroup00/LogVol00, but specifying that ( and
> several other variations ) doesn't work.
> 
> What's the magic goo needed to get grub to boot and use a root partition
> on LVM?

Ah.. LVM is absolutely the bee's knees when it works correctly yet is 
thoroughly curse-worthy when it doesn't.

I'm going to assume that System Rescue CD support LVM out of the box 
since it supports darn near everything else.  I've never used it to 
rescue an LVM-root box, though, since for that, I tend to just use the 
openSUSE boot disk or an Ultimate BootCD I have lying around.

In any event, you'll first need to scan for the LVM volume groups (vg). 
  This is done like so:

# vgscan
Reading all physical volumes . This may take a while...
Found volume group "VolGroup00" using metadata type 1vm2

Note the volume group name.  Since you're using RedHat, it should be 
exactly that.  If not, then you'll want to use whatever it finds for the 
next step... which is activating the volume group:

# vgchange -ay VolGroup00
3 logical volume(s) in volume group VolGroup00 now active.

Now the trick is to find out what the logical volumes (lv).  I tend to 
just look in /dev/VolGroup00 for that info, but this is the official way:

# lvs
   LV         VG     Attr   LSize   Origin Snap%  Move Log Copy%
   LogVol00 VolGroup00 -wi-ao  25.00G
   LogVol01 VolGroup00 -wi-ao 100.00G
   LogVol02 VolGroup00 -wi-ao  20.00G

It's rescue time once you know the names:

# mount /dev/VolGroup00 /mnt/
# mount /dev/hda1 /mnt/boot
# mount -t proc none /mnt/proc
# mount -o bind /dev /mnt/dev
# chroot /mnt /bin/bash

Since you're likely going to be doing grub work, you'll need the mounted 
drives as well:

# cp /proc/mounts /mnt/etc/mtab

And you're good to go!

(assuming you're not using an encrypted root... that takes a few more 
commands)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20080419/94c49eb7/attachment.pgp 


More information about the PLUG-discuss mailing list