[linux-lvm] No Subject

Ken Fuchs kfuchs at winternet.com
Thu Jan 15 17:05:28 UTC 2004

>On Wed, Jan 14, 2004 at 08:27:18AM -0800, trylinux wrote:

>> I recently used vgrename to rename the volume group (from rootvol to rootvg
>> -- just a test to learn some more), and it seemed to succeed. I was able to
>> run afterwards with no problems. On the first reboot after this, though, my
>> system can no longer boot. Here's a rough transcription of what's going on:

>> Activating logical volumes
>> vgchange -- volume group "rootvg" successfully activated
>> Mounting root filesystem
>> mount: error 2 mounting ext3
>> pivotroot: pivot_root(/sysroot,/sysroot/initrt) failed: 2
>> umount /initrd/proc failed: 2
>> Freeing unused kernel memory: 136k freed
>> Kernel panic: No init found. Try passing init= option to kernel.

Brant Katkansky <lists at katkansky.org> wrote:

>You need to rebuild the kernel initrd if you change your root device,
>as the linuxrc script in the initrd has the root device hard-coded.

lvmcreate_initrd(8) can be used to do this, but one might learn more by
using the following manual approach.

To better understand how LVM 1 is used in mounting the root device, one
can loop mount the initrd and at least look at the current linuxrc
script and change it as needed.  Assuming the kernel has built-in ext2
support (almost always; lvmcreate_initrd creates an ext2 initrd), here
are the steps to do this (only for anyone reading who isn't sure how):

# cd /boot
# mkdir /initrd-tmp
# cp -p initrd<remainder of filename> initrd-tmp
# file initrd-tmp

If the file is gzip compressed data do the following two steps
(filesystem is probably ext2), otherwise skip them:

    # mv initrd-tmp initrd-tmp.gz
    # gunzip initrd-tmp.gz

# mount -o loop initrd-tmp /initrd-tmp
# mount | grep initrd-tmp

If the filesystem is cramfs, the following addition steps are needed to
convert the cramfs initrd to an ext2 initrd (this step shouldn't be
required since lvmcreate_initrd creates ext2 and not cramfs):

    # dd if=/dev/zero of=initrd-ext2 bs=1024 count=4096
    # mke2fs initrd-ext2
    Proceed anyway? (y,n) y
    # mkdir /initrd-ext2
    # mount -o loop initrd-ext2 /initrd-ext2
    # (cd /initrd-tmp; tar cf - .) | (cd /initrd-ext2; tar xvf -)
    # rmdir /initrd-ext2/lost+found     <initrd doesn't need it.>
    # umount /initrd-tmp
    # umount /initrd-ext2
    # mv initrd-ext2 initrd-tmp         <replace cramfs with ext2.>
    # mount -o loop initrd-tmp /initrd-tmp

Edit the /initrd-tmp/linuxrc or other parts of the initrd such as copying
filesystem modules from / to /initrd-tmp (do insmod in linuxrc):

    # emacs /initrd-tmp/linuxrc
    # cp -p /lib/modules/<version>/kernel/fs/<potential new root fs>.o \

Red Hat may use a shorter directory structure for modules in its

Duplicate the grub/lilo boot entry that uses the original /boot/initrd*
and replace the original initrd reference in the new boot entry with
/initrd-tmp (or /boot/initrd-tmp if there is no /boot filesystem and
thus no lvm / logical volume).  Boot via the new boot entry.


Ken Fuchs <kfuchs at winternet.com>

More information about the linux-lvm mailing list