WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

[Xen-users] mkinitrd problem when LVM volume group names differ between

How can I make "mkinitrd" generate a correct ramdisk image when the LVM volume group names differ between the Dom0 and DomU?

The details:

In Dom0, the root filesystem is LVM in volume group "VGShark", as follows:

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VGShark-LogVol00
                      450G  119G  308G  28% /
/dev/sda1              99M   45M   49M  48% /boot
tmpfs                 1.9G     0  1.9G   0% /dev/shm

In the DomU, the root filesystem is LVM in volume group "VolGroup00".

Back in Dom0, I run the following to create the initrd...

#mkinitrd -f initrd-2.6.16.29-xen.img 2.6.16.29-xen

...which produces the following (snippet) in the generated "init" file in the ramdisk image:

echo Making device-mapper control node
mkdmnod
mkblkdevs
echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure  VGShark
resume /dev/VGShark/LogVol01
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VGShark/LogVol00
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot

The DomU config file is:

kernel = "/boot/vmlinuz-2.6.16.29-xen"
ramdisk = "/boot/initrd-2.6.16.29-xen.img"
root = "/dev/VolGroup00/LogVol00 ro"
name = "minnow"
memory = "512"
disk = [ 'file:/var/vm/minnow/disk0.img,xvda,w' ]
vif = [ 'mac=00:16:3e:00:e6:8f' ]
uuid = "7e6aa8bb-37da-3a7f-e72e-63290fcf2713"

..which produces the following error at domU boot time:

Making device-mapper control node
Scanning logical volumes
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGroup00" using metadata type lvm2
Activating logical volumes
  Unable to find volume group "VGShark"
Creating root device.
Mounting root filesystem.
mount: could not find filesystem '/dev/root'
Setting up other filesystems.
Setting up new root fs
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!

So --

Here is the /etc/fstab (in Dom0):

#cat fstab
/dev/VGShark/LogVol00   /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
sysfs                   /sys                    sysfs   defaults        0 0
/dev/VGShark/LogVol01   swap                    swap    defaults        0 0

I copy this file to create fstab.domU, and change the references to VGShark to VolGroup00, which is:

#cat fstab.domU
/dev/VolGroup00/LogVol00   /                    ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
sysfs                   /sys                    sysfs   defaults        0 0
/dev/VolGroup00/LogVol01   swap                 swap    defaults        0 0

This matches exactly what DomU is expecting.

I rebuild initrd with the following command:

# mkinitrd -f --fstab=/etc/fstab.domU initrd-2.6.16.29-xen.img 2.6.16.29-xen

...which produces the following (snippet) in the generated "init" file in the ramdisk image:

mkblkdevs
resume /dev/VolGroup00/LogVol01
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VolGroup00/LogVol00
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot

I try again to boot the DomU with the same config file listed above and I get this error:

Creating root device.
Mounting root filesystem.
mount: could not find filesystem '/dev/root'
Setting up other filesystems.
Setting up new root fs
setuproot: moving /dev failed: No such file or directory
no fstab.sys, mounting internal defaults
setuproot: error mounting /proc: No such file or directory
setuproot: error mounting /sys: No such file or directory
Switching to new root and running init.
unmounting old /dev
unmounting old /proc
unmounting old /sys
switchroot: mount failed: No such file or directory
Kernel panic - not syncing: Attempted to kill init!

Next --

I modify the generated "init" file in the ramdisk image to the following (replace VGShark with VolGroup00):

mkdmnod
mkblkdevs
echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure  VolGroup00
resume /dev/VolGroup00/LogVol01
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VolGroup/LogVol00
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot

I rebuild the initrd image, and change the ramdisk line in the domU config to:

kernel = "/boot/vmlinuz-2.6.16.29-xen"
ramdisk = "/boot/initrdDomU.img"
root = "/dev/VolGroup00/LogVol00 ro"
name = "minnow"
memory = "512"
disk = [ 'file:/var/vm/minnow/disk0.img,xvda,w' ]
vif = [ 'mac=00:16:3e:00:e6:8f' ]
uuid = "7e6aa8bb-37da-3a7f-e72e-63290fcf2713"

...and the DomU boots up!

The conclusion I draw is that mkinitrd is not creating a good ramdisk image.

How can I make mkinitrd generate a correct ramdisk image when the volume group names differ between the Dom0 and DomU?

TIA,

- Mike


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

<Prev in Thread] Current Thread [Next in Thread>