How do I switch LVM disks?

Paul Howarth paul at city-fan.org
Tue Feb 21 13:13:39 UTC 2006


Neal Becker wrote:
> I got a new disk, and created LVMs on it.  I copied the filesystems OK. 
> But, how do I get the new disk mounted as /?  For that matter, what
> determines what LVM gets mounted where?  I'm guessing it's part of the LVM
> information.  I noticed that system-config-lvm has options to select where
> logical partitions get mounted.
> 
> I hope I don't need to switch it by editing with system-config-lvm - because
> if I mess that up, I'm basically screwed.
> 
> I tried editing grub.conf:
> 
> title Fedora Core (2.6.15-1.1948_FC5)
>         root (hd0,2)
>         kernel /vmlinuz-2.6.15-1.1948_FC5 ro root=/dev/VolGroup00/LogVol00
> rhgb quiet
>         initrd /initrd-2.6.15-1.1948_FC5.img
> title Fedora Core (2.6.15-1.1948_FC5)#2
>         root (hd0,2)
>         kernel /vmlinuz-2.6.15-1.1948_FC5 ro root=/dev/7200rpm/LogVol02 rhgb
> quiet
>         initrd /initrd-2.6.15-1.1948_FC5.img
> 
> But if I select #2 it panics saying it can't find /dev/root, (or something
> like that).
> Here's some info:
> lvm> lvscan
>   ACTIVE            '/dev/7200rpm/LogVol03' [2.00 GB] inherit
>   ACTIVE            '/dev/7200rpm/LogVol02' [53.50 GB] inherit
>   ACTIVE            '/dev/VolGroup00/LogVol00' [53.59 GB] inherit
>   ACTIVE            '/dev/VolGroup00/LogVol01' [1.94 GB] inherit
> lvm> pvscan
>   PV /dev/hdb4   VG 7200rpm      lvm2 [55.50 GB / 0    free]
>   PV /dev/hda5   VG VolGroup00   lvm2 [55.56 GB / 32.00 MB free]
>   PV /dev/hdb3                   lvm2 [196.11 MB]
>   Total: 3 [111.26 GB] / in use: 2 [111.07 GB] / in no VG: 1 [196.11 MB]
> lvm> vgscan
>   Reading all physical volumes.  This may take a while...
>   Found volume group "7200rpm" using metadata type lvm2
>   Found volume group "VolGroup00" using metadata type lvm2

If you extract the contents of your initrd, you'll probably find in 
"init" the following lines:

echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure VolGroup00

You can extract the initrd as follows:

$ cd /tmp
$ mkdir initrd
$ cd initrd
$ gzip -dc < /boot/initrd-2.6.15-1.1948_FC5.img | cpio -i

You might be able to produce a suitable initrd by editing your 
/etc/fstab (at least temporarily) to point to the right logical volumes 
and then run mkinitrd to create a new initrd for booting from the new disk.

Paul.




More information about the fedora-list mailing list